Adds final test, all three now pass.
This commit is contained in:
parent
04eefa4e0e
commit
af30063a92
2 changed files with 14 additions and 4 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue