def test_get_competitors_with_admission_company(self): mommy.make( "dpnk.Company", name="Foo company", ) competition = mommy.make( "dpnk.Competition", competitor_type="company", campaign=self.campaign, ) query = results.get_competitors(competition) self.assertQuerysetEqual(query.all(), ['<Company: Foo company>'])
def test_get_competitors_with_admission_single(self): mommy.make( "dpnk.UserAttendance", userprofile__nickname="Foo user", campaign=self.campaign, transactions=[mommy.make('Payment', status=99)], approved_for_team='approved', ) competition = mommy.make( "dpnk.Competition", competitor_type="single_user", campaign=self.campaign, ) query = results.get_competitors(competition) self.assertQuerysetEqual(query.all(), ['<UserAttendance: Foo user>'])
def test_get_competitors_liberos(self): team = mommy.make( "dpnk.Team", name="Foo team", campaign=self.campaign, ) mommy.make( "dpnk.UserAttendance", userprofile__nickname="Foo user", team=team, campaign=self.campaign, approved_for_team='approved', ) team.save() competition = mommy.make( "dpnk.Competition", competitor_type="liberos", campaign=self.campaign, ) query = results.get_competitors(competition) self.assertQuerysetEqual(query.all(), ['<UserAttendance: Foo user>'])
def test_get_competitors_with_admission_team(self): team = mommy.make( "dpnk.Team", name="Foo team", campaign=self.campaign, ) for name in ["Foo user", "Bar user"]: mommy.make( "dpnk.UserAttendance", userprofile__nickname=name, team=team, campaign=self.campaign, approved_for_team='approved', ) team.save() competition = mommy.make( "dpnk.Competition", competitor_type="team", campaign=self.campaign, ) query = results.get_competitors(competition) self.assertQuerysetEqual(query.all(), ['<Team: Foo team (Foo user, Bar user)>'])
def test_get_competitors_liberos(liberos_competition, team, ua1): query = results.get_competitors(liberos_competition) assert str(query.all()) == "<QuerySet [<UserAttendance: Foo user>]>"
def test_get_competitors_with_admission_company(company, company_competition): competition = company_competition query = results.get_competitors(competition) assert str(query.all()) == "<QuerySet [<Company: Foo company>]>"
def test_get_competitors_with_admission_team(ua1, ua2, team, team_competition): competition = team_competition query = results.get_competitors(competition) assert str( query.all()) == "<QuerySet [<Team: Foo team (Bar user, Foo user)>]>"
def test_get_competitors_with_admission_single(ua1, single_user_competition): competition = single_user_competition query = results.get_competitors(competition) assert str(query.all()) == "<QuerySet [<UserAttendance: Foo user>]>"