Browse Source

Replace game.game_player with game.player

testing
Burathar 5 years ago
parent
commit
9b30c334b1
  1. 24
      app/tests/test_models.py
  2. 16
      the_hunt.py

24
app/tests/test_models.py

@ -27,8 +27,8 @@ class ModelsCase(unittest.TestCase):
u1 = User(name='Henk') u1 = User(name='Henk')
u2 = User(name='Alfred') u2 = User(name='Alfred')
g1.game_players.append(GamePlayer(player=u1, role=Role.owner)) g1.players.append(GamePlayer(player=u1, role=Role.owner))
g1.game_players.append(GamePlayer(player=u2, role=Role.bunny)) g1.players.append(GamePlayer(player=u2, role=Role.bunny))
db.session.add(g1) db.session.add(g1)
db.session.commit() db.session.commit()
@ -44,11 +44,11 @@ class ModelsCase(unittest.TestCase):
u2 = User(name='Alfred') u2 = User(name='Alfred')
u3 = User(name='Sasha') u3 = User(name='Sasha')
g1.game_players.append(GamePlayer(player=u1, role=Role.owner)) g1.players.append(GamePlayer(player=u1, role=Role.owner))
g1.game_players.append(GamePlayer(player=u2, role=Role.bunny)) g1.players.append(GamePlayer(player=u2, role=Role.bunny))
g2.game_players.append(GamePlayer(player=u1, role=Role.hunter)) g2.players.append(GamePlayer(player=u1, role=Role.hunter))
g2.game_players.append(GamePlayer(player=u3, role=Role.bunny)) g2.players.append(GamePlayer(player=u3, role=Role.bunny))
db.session.add(g1) db.session.add(g1)
@ -65,8 +65,8 @@ class ModelsCase(unittest.TestCase):
g2 = Game(name='AnotherGame') g2 = Game(name='AnotherGame')
u1 = User(name='Henk') u1 = User(name='Henk')
g1.game_players.append(GamePlayer(player=u1, role=Role.owner)) g1.players.append(GamePlayer(player=u1, role=Role.owner))
g2.game_players.append(GamePlayer(player=u1, role=Role.bunny)) g2.players.append(GamePlayer(player=u1, role=Role.bunny))
o1 = Objective(name='o1') o1 = Objective(name='o1')
o1.set_hash() o1.set_hash()
@ -92,10 +92,10 @@ class ModelsCase(unittest.TestCase):
u4 = User(name='Demian') u4 = User(name='Demian')
u5 = User(name='Karl') u5 = User(name='Karl')
g1.game_players.append(GamePlayer(player=u1, role=Role.owner)) g1.players.append(GamePlayer(player=u1, role=Role.owner))
g1.game_players.append(GamePlayer(player=u2, role=Role.bunny)) g1.players.append(GamePlayer(player=u2, role=Role.bunny))
g1.game_players.append(GamePlayer(player=u3, role=Role.hunter)) g1.players.append(GamePlayer(player=u3, role=Role.hunter))
g1.game_players.append(GamePlayer(player=u4, role=Role.none)) g1.players.append(GamePlayer(player=u4, role=Role.none))
db.session.add(g1) db.session.add(g1)
db.session.add(u5) db.session.add(u5)

16
the_hunt.py

@ -24,15 +24,15 @@ def create_objects():
u4 = User(name='Emma') u4 = User(name='Emma')
u5 = User(name='Demi') u5 = User(name='Demi')
g1.game_players.append(GamePlayer(user=u1, role=Role.owner)) g1.players.append(GamePlayer(user=u1, role=Role.owner))
g1.game_players.append(GamePlayer(user=u2, role=Role.hunter)) g1.players.append(GamePlayer(user=u2, role=Role.hunter))
g1.game_players.append(GamePlayer(user=u3, role=Role.hunter)) g1.players.append(GamePlayer(user=u3, role=Role.hunter))
g1.game_players.append(GamePlayer(user=u4, role=Role.bunny)) g1.players.append(GamePlayer(user=u4, role=Role.bunny))
g1.game_players.append(GamePlayer(user=u5, role=Role.bunny)) g1.players.append(GamePlayer(user=u5, role=Role.bunny))
g2.game_players.append(GamePlayer(user=u1, role=Role.bunny)) g2.players.append(GamePlayer(user=u1, role=Role.bunny))
g2.game_players.append(GamePlayer(user=u2, role=Role.owner)) g2.players.append(GamePlayer(user=u2, role=Role.owner))
g2.game_players.append(GamePlayer(user=u3, role=Role.hunter)) g2.players.append(GamePlayer(user=u3, role=Role.hunter))
db.session.add(g1) db.session.add(g1)
db.session.add(g2) db.session.add(g2)

Loading…
Cancel
Save