def test_b_get_tournaments(self): new_user = yield from challonge.get_user(username, api_key) ts = yield from new_user.get_tournaments() self.assertIsInstance(ts, list) ts = yield from new_user.get_tournaments(subdomain=organization) self.assertIsInstance(ts, list) random_name = get_random_name() t1 = yield from new_user.create_tournament(random_name, random_name) t1_by_id = yield from new_user.get_tournament(t1.id) self.assertEqual(t1, t1_by_id) t1_by_url = yield from new_user.get_tournament(url=t1.url) self.assertEqual(t1, t1_by_url) t1_forced = yield from new_user.get_tournament(t1.id, force_update=True) self.assertEqual(t1, t1_forced) random_name = get_random_name() t2 = yield from new_user.create_tournament(random_name, random_name, subdomain=organization) self.assertEqual(t2.subdomain, organization) t2_by_url = yield from new_user.get_tournament(url=t2.url, subdomain=organization) self.assertEqual(t2, t2_by_url) with self.assertRaises(challonge.APIException): yield from new_user.get_tournament(-1) yield from new_user.destroy_tournament(t1) yield from new_user.destroy_tournament(t2)
def setUp(self): self.user = yield from challonge.get_user(username, api_key)
def test_cleanup(self): user = yield from challonge.get_user(username, api_key) tournaments = yield from user.get_tournaments() for t in tournaments[:]: if t.name.startswith('achallonge'): yield from user.destroy_tournament(t)