Browse Source

add method to the_hunt.py to create testing objects in database

testing
Burathar 5 years ago
parent
commit
0a9e3d4539
  1. 27
      the_hunt.py

27
the_hunt.py

@ -9,4 +9,29 @@ def make_shell_context(): @@ -9,4 +9,29 @@ def make_shell_context():
return {'db': db, 'Game' : Game, 'Player' : Player, 'Objective' : Objective,
'Location' : Location, 'Notification' : Notification, 'GamePlayer' : GamePlayer,
'PlayerFoundObjective' : PlayerFoundObjective, 'NotificationPlayer' : NotificationPlayer,
'PlayerCaughtPlayer' : PlayerCaughtPlayer, 'Role' : Role, 'GameState' : GameState}
'PlayerCaughtPlayer' : PlayerCaughtPlayer, 'Role' : Role, 'GameState' : GameState,
'create_objects' : create_objects}
def create_objects():
g1 = Game(name='TestGame')
g2 = Game(name='MyGame')
p1 = Player(name='Marijn')
p2 = Player(name='Rogier')
p3 = Player(name='Henk')
p4 = Player(name='Emma')
p5 = Player(name='Demi')
g1.game_players.append(GamePlayer(player=p1, role=Role.owner))
g1.game_players.append(GamePlayer(player=p2, role=Role.hunter))
g1.game_players.append(GamePlayer(player=p3, role=Role.hunter))
g1.game_players.append(GamePlayer(player=p4, role=Role.bunny))
g1.game_players.append(GamePlayer(player=p5, role=Role.bunny))
g2.game_players.append(GamePlayer(player=p1, role=Role.bunny))
g2.game_players.append(GamePlayer(player=p2, role=Role.owner))
g2.game_players.append(GamePlayer(player=p3, role=Role.hunter))
db.session.add(g1)
db.session.add(g2)
db.session.commit()
Loading…
Cancel
Save