Exemplo n.º 1
0
    def test_exp_level(self):
        data = {"expLevel": 241}
        member = ClanMember(data=data, client=None)
        self.assertEqual(member.exp_level, data["expLevel"])

        member2 = ClanMember(data=MOCK_CLAN_MEMBER, client=None)
        self.assertIsInstance(member2.exp_level, int)
Exemplo n.º 2
0
 def test_league(self):
     data = {
         "league": {
             "id": 29000022,
             "name": "Legend League",
         }
     }
     member = ClanMember(data=data, client=None)
     league = League(data=data["league"], client=None)
     self.assertEqual(member.league, league)
     self.assertIsInstance(member.league, League)
Exemplo n.º 3
0
 def test_role(self):
     data = [{
         "role": "member"
     }, {
         "role": "admin"
     }, {
         "role": "coLeader"
     }, {
         "role": "leader"
     }]
     for case in data:
         member = ClanMember(data=case, client=None)
         role = Role(case["role"])
         self.assertEqual(member.role, role)
         self.assertIsInstance(member.role, Role)
         role_readable = str(role)
         self.assertIsInstance(role_readable, str)
         self.assertNotEqual(role_readable, role)
Exemplo n.º 4
0
 def test_clan(self):
     data = {
         "clan": {
             "tag": "#8J8QJ2LV",
             "name": "Reddit Ace",
             "clanLevel": 18,
             "badgeUrls": {
                 "small":
                 "https://api-assets.clashofclans.com/badges/70/thXuucdocdtfUts55bsAoGfQ0P8ghwLezzeG-UUajp0.png",
                 "large":
                 "https://api-assets.clashofclans.com/badges/512/thXuucdocdtfUts55bsAoGfQ0P8ghwLezzeG-UUajp0.png",
                 "medium":
                 "https://api-assets.clashofclans.com/badges/200/thXuucdocdtfUts55bsAoGfQ0P8ghwLezzeG-UUajp0.png",
             },
         }
     }
     member = ClanMember(data=data, client=None)
     clan = PlayerClan(data=data["clan"], client=None)
     self.assertEqual(member.clan, clan)
     self.assertIsInstance(member.clan, PlayerClan)
Exemplo n.º 5
0
 def test_received(self):
     data = [{"donationsReceived": 9876}, {"donationsReceived": 0}, {}]
     for case in data:
         member = ClanMember(data=case, client=None)
         self.assertEqual(member.received, case.get("donationsReceived"))
Exemplo n.º 6
0
 def test_donations(self):
     data = [{"donations": 55}, {"donations": 0}, {}]
     for case in data:
         member = ClanMember(data=case, client=None)
         self.assertEqual(member.donations, case.get("donations"))
Exemplo n.º 7
0
 def test_clan_previous_rank(self):
     data = [{"previousClanRank": 14}, {"previousClanRank": 4}, {}]
     for case in data:
         member = ClanMember(data=case, client=None)
         self.assertEqual(member.clan_previous_rank,
                          case.get("previousClanRank"))
Exemplo n.º 8
0
 def test_versus_trophies(self):
     data = [{"versusTrophies": 4433}, {"versusTrophies": 0}, {}]
     for case in data:
         member = ClanMember(data=case, client=None)
         self.assertEqual(member.versus_trophies,
                          case.get("versusTrophies"))
Exemplo n.º 9
0
 def test_trophies(self):
     data = [{"trophies": 5432}, {"trophies": 0}, {}]
     for case in data:
         member = ClanMember(data=case, client=None)
         self.assertEqual(member.trophies, case.get("trophies"))