Example #1
0
 def test_steam_32_64(self):
     steam32 = 123456
     steam64 = 76561197960265728 + steam32
     account1 = entities.SteamAccount(account_id=steam64)
     account2 = entities.SteamAccount(account_id=steam32)
     self.assertEqual(
         account1, account2,
         'SteamAccount created with 32 Bit or 64 Bit SteamID should be indistinguishable'
     )
Example #2
0
    def test_leaver_status(self):
        match_id = '4176987886'
        res = self.get_match_details(match_id)
        self.assertTrue(res.has_leavers(), "get_match_details(\'{0}\').has_leavers() is True".format(match_id))

        leavers = [entities.SteamAccount(account_id = 4294967295),
        entities.SteamAccount(account_id = 283619584),
        entities.SteamAccount(account_id = 20778465),
        entities.SteamAccount(account_id = 4294967295),
        entities.SteamAccount(account_id = 59769890)]

        self.assertEqual(res.leavers(), leavers,
        "get_match_details(\'{0}\').leavers() does not work as intended".format(match_id))
Example #3
0
 def test_steamaccount_repr(self):
     steam_repr = repr(entities.SteamAccount(1))
     steam_match_str = "SteamAccount(account_id = 1)"
     self.assertEqual(
         steam_repr, steam_match_str,
         "repr(entities.SteamAccount(1)) should be {0}".format(
             steam_match_str))
Example #4
0
    def test_steamaccount_arg(self):
        steam_account = entities.SteamAccount('76561198088874284')
        account_id = '76561198088874284'

        res1 = self.get_match_history(steam_account = steam_account)
        res2 = self.get_match_history(account_id = account_id)

        self.assertEqual(res1, res2,
        "get_match_history(steam_account = {0}) should be the same as get_match_history(match_id = {1})".format(steam_account, account_id))
Example #5
0
    def test_interchangeable_args(self):
        account_ids = [1, 2]
        steam_accounts = [entities.SteamAccount(x) for x in account_ids]

        res_ids = self.get_player_summaries(account_ids = account_ids)
        res_steam_accs = self.get_player_summaries(steam_accounts = steam_accounts)

        self.assertEqual(res_ids, res_steam_accs,
        "Account ID list argument should return same response as SteamAccount list argument")
Example #6
0
from d2api.src import entities

# Hero/Item/Ability information is available without having to specify a key
print(entities.Hero(67)['hero_name'])
print(entities.Item(208)['item_aliases'])
print(entities.Ability(6697)['ability_name'])

# Use steam32/steam64 IDs interchangeably
steam_account = entities.SteamAccount(1020002)
print(steam_account['id32'], steam_account['id64'])
Example #7
0
 def test_steamaccount_bool(self):
     acct1 = entities.SteamAccount(None)
     acct2 = entities.SteamAccount(2)
     self.assertTrue(not acct1, "not {0} should be True".format(acct1))
     self.assertFalse(not acct2, "not {0} should be False".format(acct2))