From af30063a92c07c50ba8646d6eea8802944630c10 Mon Sep 17 00:00:00 2001 From: Christopher Neugebauer Date: Sun, 4 Sep 2016 14:00:56 +1000 Subject: [PATCH] Adds final test, all three now pass. --- registrasion/controllers/conditions.py | 5 ++--- registrasion/tests/test_speaker.py | 13 ++++++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/registrasion/controllers/conditions.py b/registrasion/controllers/conditions.py index 7ca8e431..ac198347 100644 --- a/registrasion/controllers/conditions.py +++ b/registrasion/controllers/conditions.py @@ -311,16 +311,15 @@ class SpeakerConditionController(IsMetByFilter, ConditionController): being a presenter or copresenter of a proposal. ''' u = user - # User is a presenter user_is_presenter = Q( is_presenter=True, - proposal_kind__section__presentations__speaker__user=u, + proposal_kind__proposalbase__presentation__speaker__user=u, ) # User is a copresenter user_is_copresenter = Q( is_copresenter=True, - proposal_kind__section__presentations__additional_speakers__user=u, + proposal_kind__proposalbase__presentation__additional_speakers__user=u, ) return queryset.filter(user_is_presenter | user_is_copresenter) diff --git a/registrasion/tests/test_speaker.py b/registrasion/tests/test_speaker.py index 0262561d..e3b14ed0 100644 --- a/registrasion/tests/test_speaker.py +++ b/registrasion/tests/test_speaker.py @@ -191,8 +191,19 @@ class SpeakerTestCase(RegistrationCartTestCase): self._create_flag_for_primary_speaker() # USER_1 cannot see PROD_1 until proposal is promoted. + available = ProductController.available_products( + self.USER_1, + products=[self.PROD_1], + ) + self.assertNotIn(self.PROD_1, available) # promote proposal_2 so that USER_1 becomes a speaker, but of # KIND_2, which is not covered by this condition + promote_proposal(self.PROPOSAL_2) - # USER_2 cannot see PROD_1 + # USER_1 cannot see PROD_1 + available_1 = ProductController.available_products( + self.USER_1, + products=[self.PROD_1], + ) + self.assertNotIn(self.PROD_1, available_1)