Example #1
0
 def test_guild_view_total_separatists(self):
     guild = generate_guild(player_count=0)
     players = PlayerFactory.create_batch(3, guild=guild)
     unit = UnitFactory(categories=Category.objects.filter(
         api_id='affiliation_separatist'))
     for player in players:
         PlayerUnitFactory(player=player, gp=1000, unit=unit)
     url = reverse('sqds:guild', args=[guild.api_id])
     response = self.client.get(url)
     text = big_number(3000.)
     self.assertContains(response, text)
Example #2
0
def test_update_all_with_ally_code(db):
    """
    Medals should not be created for player unit belonging to players whose ally code
    are not passed to MedalManager.update_all()
    """
    unit = UnitFactory()
    for x in range(7):
        StatMedalRuleFactory(unit=unit, stat="health", value=x * 1000)

    p1, p2 = PlayerFactory.create_batch(2)
    PlayerUnitFactory(player=p1, unit=unit, health=3500)
    pu2 = PlayerUnitFactory(player=p2, unit=unit, health=3500)

    Medal.objects.update_all(ally_codes=[p1.ally_code])
    assert Medal.objects.count() == 4
    assert Medal.objects.filter(player_unit=pu2).count() == 0

    Medal.objects.update_all()
    assert Medal.objects.count() == 8