-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
977c123
commit b11866b
Showing
6 changed files
with
108 additions
and
7 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
from coach.models import Coach | ||
from core.models import Event, EventPageContent, EventPageMenu | ||
from core.models.organizerissue import OrganizerIssue | ||
from globalpartners.models import GlobalPartner | ||
from sponsor.models import Sponsor | ||
from story.models import Story | ||
|
@@ -151,3 +152,39 @@ def old_event_no_date(organizer_peter): | |
) | ||
event.team.add(organizer_peter) | ||
return event | ||
|
||
|
||
@pytest.fixture | ||
def organizer_issue(organizer_peter, old_event, admin_user): | ||
issue = OrganizerIssue.objects.create( | ||
organizer=organizer_peter, | ||
event=old_event, | ||
date_reported="2023-10-12", | ||
reported_by="Jane Doe", | ||
reporter_email="[email protected]", | ||
issue="He was rude and disrespectful.", | ||
issue_handled=True, | ||
issue_handled_by=admin_user, | ||
findings="He was rude indeed.", | ||
comments="He should be blacklisted from organizing more events.", | ||
) | ||
return issue | ||
|
||
|
||
@pytest.fixture | ||
def reverse_blacklisting(organizer_julia, old_event, admin_user): | ||
organizer_julia.is_blacklisted = True | ||
organizer_julia.save() | ||
issue = OrganizerIssue.objects.create( | ||
organizer=organizer_julia, | ||
event=old_event, | ||
date_reported="2023-10-12", | ||
reported_by="John Doe", | ||
reporter_email="[email protected]", | ||
issue="She was very arrogant.", | ||
issue_handled=True, | ||
issue_handled_by=admin_user, | ||
findings="She was not polite.", | ||
comments="It was just a misunderstanding.", | ||
) | ||
return issue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
import pytest | ||
from django_date_extensions.fields import ApproximateDate | ||
|
||
from core.models import Event | ||
from core.models import Event, User | ||
from organize.constants import ON_HOLD | ||
from organize.models import Coorganizer, EventApplication | ||
|
||
|
@@ -482,3 +482,40 @@ def previous_application_approximate_date(): | |
main_organizer_last_name="Smith", | ||
status="deployed", | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def main_organizer_is_blacklisted(): | ||
main_organizer = User.objects.create( | ||
first_name="Anna", | ||
last_name="Smith", | ||
email="[email protected]", | ||
password="password", | ||
is_active=True, | ||
is_superuser=False, | ||
is_staff=True, | ||
is_blacklisted=True, | ||
) | ||
return main_organizer | ||
|
||
|
||
@pytest.fixture | ||
def data_dict_new_organizer(): | ||
return { | ||
"about_you": "I am a volunteer in my local meet-up.", | ||
"why": "There are a few women who know how to code in our meet-up.", | ||
"involvement": "coach", | ||
"experience": "I have volunteered at my local meet-up.", | ||
"main_organizer_email": "[email protected]", | ||
"main_organizer_first_name": "Anna", | ||
"main_organizer_last_name": "Smith", | ||
"remote": True, | ||
"date": ApproximateDate(2081, 3, 10), | ||
"city": "Harare", | ||
"country": "ZW", | ||
"sponsorship": "Yes", | ||
"coaches": "Yes", | ||
"tools": "Zoom", | ||
"diversity": "Reach out", | ||
"additional": "No", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,3 +126,19 @@ def test_coorganizer_str(base_application): | |
event_application=base_application, email="[email protected]", first_name="Anna", last_name="Smith" | ||
) | ||
assert str(org) == f"{org.first_name} {org.last_name} <{org.email}>" | ||
|
||
|
||
def test_main_organizer_is_blacklisted(data_dict, main_organizer_is_blacklisted): | ||
event = EventApplication.object.create(**data_dict) | ||
assert event.organizer_blacklisted is True | ||
assert EventApplication.object.count() == 1 | ||
|
||
|
||
def test_main_organizer_is_not_blacklisted(data_dict): | ||
EventApplication.object.create(**data_dict) | ||
assert EventApplication.object.count() == 1 | ||
|
||
|
||
def test_new_organizer(data_dict_new_organizer): | ||
EventApplication.object.create(**data_dict_new_organizer) | ||
assert EventApplication.object.count() == 1 |