|
1 | 1 | from conferences.tests.factories import ConferenceFactory |
2 | 2 | from participants.tests.factories import ParticipantFactory |
| 3 | +from submissions.tests.factories import SubmissionFactory |
| 4 | +from submissions.models import Submission |
3 | 5 | import pytest |
4 | 6 |
|
5 | 7 |
|
@@ -49,6 +51,56 @@ def test_user_participant(user, graphql_client): |
49 | 51 | assert participant_type["previousTalkVideo"] == "" |
50 | 52 |
|
51 | 53 |
|
| 54 | +def test_user_participant_proposals(user, graphql_client): |
| 55 | + graphql_client.force_login(user) |
| 56 | + participant = ParticipantFactory( |
| 57 | + user_id=user.id, |
| 58 | + bio="biiiiio", |
| 59 | + photo="https://marcopycontest.blob.core.windows.net/participants-avatars/blob.jpg", |
| 60 | + website="https://google.it", |
| 61 | + twitter_handle="marco", |
| 62 | + speaker_level="intermediate", |
| 63 | + previous_talk_video="", |
| 64 | + ) |
| 65 | + proposal_1 = SubmissionFactory( |
| 66 | + speaker_id=participant.user_id, |
| 67 | + conference=participant.conference, |
| 68 | + status=Submission.STATUS.accepted, |
| 69 | + ) |
| 70 | + SubmissionFactory( |
| 71 | + speaker_id=participant.user_id, |
| 72 | + conference=participant.conference, |
| 73 | + status=Submission.STATUS.rejected, |
| 74 | + ) |
| 75 | + SubmissionFactory(speaker_id=participant.user_id, status=Submission.STATUS.accepted) |
| 76 | + |
| 77 | + response = graphql_client.query( |
| 78 | + """query($conference: String!) { |
| 79 | + me { |
| 80 | + participant(conference: $conference) { |
| 81 | + id |
| 82 | + bio |
| 83 | + photo |
| 84 | + website |
| 85 | + twitterHandle |
| 86 | + speakerLevel |
| 87 | + previousTalkVideo |
| 88 | + proposals { |
| 89 | + id |
| 90 | + } |
| 91 | + } |
| 92 | + } |
| 93 | + }""", |
| 94 | + variables={"conference": participant.conference.code}, |
| 95 | + ) |
| 96 | + |
| 97 | + participant_type = response["data"]["me"]["participant"] |
| 98 | + |
| 99 | + assert participant_type["id"] == participant.hashid |
| 100 | + assert len(participant_type["proposals"]) == 1 |
| 101 | + assert participant_type["proposals"][0]["id"] == proposal_1.hashid |
| 102 | + |
| 103 | + |
52 | 104 | def test_user_participant_when_it_doesnt_exist(user, graphql_client): |
53 | 105 | graphql_client.force_login(user) |
54 | 106 | conference_code = ConferenceFactory().code |
|
0 commit comments