class Test(unittest.TestCase): def setUp(self): # self.control = TestControl(db_url="sqlite:///",drop_all=True) self.control = TestControl(db_url="sqlite:///lobby.db",drop_all=True) def tearDown(self): pass def testName(self): with self.control.session as session: admin = session.query(model.User).get(1) foo = model.User(name="foo",_password="******") bar = model.User(name="bar",_password="******") session.add_all([foo,bar]) session.flush() btgs = [model.Battleground(name="Garden of Terror"), model.Battleground(name="Tomb of the Spider Queen")] session.add_all(btgs) lobby = model.Lobby(name="Foo's Lobby", region=model.Lobby.REGION[0], battleground=btgs[0]) foo.lobbies.append(lobby) red = model.Team(name="Red") lobby.teams.append(red) blue = model.Team(name="Blue") lobby.teams.append(blue) red.members.append(foo) blue.members.append(bar) lobby = model.Lobby(name="Foo's other Lobby", region=model.Lobby.REGION[1], battleground=btgs[1]) foo.lobbies.append(lobby) red = model.Team(name="Red") lobby.teams.append(red) blue = model.Team(name="Blue") lobby.teams.append(blue) red.members.append(foo) blue.members.append(bar) blue.members.append(admin) session.commit() print(dumps(self.control.get_lobby(1, 1),indent=2))
def setUp(self): # self.control = TestControl(db_url="sqlite:///",drop_all=True) self.control = TestControl(db_url="sqlite:///lobby.db",drop_all=True)