Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fp12 committed Jan 10, 2017
1 parent 479ece9 commit 254f332
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion challonge/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from .helpers import ChallongeException
from .user import User, get_user
from .tournament import Tournament, TournamentType, DoubleEliminationEnding
from .tournament import Tournament, TournamentType, DoubleEliminationEnding, RankingOrder, Pairing
from .participant import Participant
from .match import Match
from .attachment import Attachment
10 changes: 0 additions & 10 deletions challonge/helpers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import aiohttp
import functools

from . import CHALLONGE_USE_FIELDS_DESCRIPTORS

Expand Down Expand Up @@ -100,12 +99,3 @@ def val(value):

def get_connection(username, api_key, timeout=DEFAULT_TIMEOUT, loop=None):
return Connection(username, api_key, timeout, loop)


def partial_method(func, name, doc, *args1, **kwargs1):
@functools.wraps(func) # copy attributes to start, they can be overwritten later
def method(self, *args2, **kwargs2):
return func(self, *args1, *args2, **kwargs1, **kwargs2)
method.__name__ = name
method.__doc__ = doc
return method
18 changes: 16 additions & 2 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ def test_aa_basic_options(self):
self.assertEqual(t.url, random_url)

random_desc = get_random_name()
yield from t.update_url(random_desc)
self.assertEqual(t.url, random_desc)
yield from t.update_description(random_desc)
self.assertEqual(t.description, random_desc)

yield from self.user.destroy_tournament(t)

Expand Down Expand Up @@ -138,6 +138,9 @@ def test_ab_options(self):
yield from t.set_max_participants(25)
self.assertEqual(t.signup_cap, 25)

yield from t.update_pairing_method(challonge.Pairing.sequential)
self.assertTrue(t.sequential_pairings)

yield from self.user.destroy_tournament(t)

# @unittest.skip('')
Expand Down Expand Up @@ -352,6 +355,9 @@ def test_i_swiss(self):
yield from t.setup_swiss_rounds(rounds)
self.assertEqual(t.swiss_rounds, rounds)

yield from t.start()
yield from t.matches[0].report_tie('1-1')

yield from self.user.destroy_tournament(t)

# @unittest.skip('')
Expand All @@ -377,6 +383,9 @@ def test_j_round_robin(self):
self.assertEqual(float(t.rr_pts_for_game_win), 0.3)
self.assertEqual(float(t.rr_pts_for_game_tie), 0.1)

yield from t.update_ranking_order(challonge.RankingOrder.points_scored)
self.assertEqual(t.ranked_by, challonge.RankingOrder.points_scored.value)

yield from self.user.destroy_tournament(t)

# @unittest.skip('')
Expand All @@ -395,6 +404,11 @@ def test_k_single_elim(self):
yield from t.set_single_elim_third_place_match(True)
self.assertTrue(t.hold_third_place_match)

yield from t.add_participants('p1', 'p2')
yield from t.start()
yield from t.matches[0].report_winner(t.participants[0], '1-0')
yield from t.finalize()

yield from self.user.destroy_tournament(t)

# @unittest.skip('')
Expand Down

0 comments on commit 254f332

Please sign in to comment.