def test_view(): game = json.dumps({'ID': None, 'kind': 'game', 'name': 'Game2', 'company': 'Company1', 'minPlayers': 1, 'maxPlayers': 4, 'age': 10, 'length': 30, 'link': 'www.example.com', 'image': None, 'notes': 'Fun!'}) mini = json.dumps({'ID': None, 'kind': 'mini', 'name': 'Mini2', 'army': 'Orcs and Goblins', 'type': 'core', 'system': 'WFB', 'company': 'Company1', 'quantity': 10, 'status': 'painted', 'link': 'www.example.com', 'image': None, 'notes': 'Fun!'}) paint = json.dumps({'ID': None, 'kind': 'paint', 'name': 'Paint2', 'color': 'green', 'type': 'matte', 'company': 'Company1', 'quantity': 1, 'link': 'www.example.com', 'notes': 'Fun!'}) assert model.view(game) == '[2, "game", "Game2", "Company1", 1, \ 4, 10, 30, "www.example.com", null, "Fun!"]' assert model.view(mini) == '[2, "mini", "Mini2", \ "Orcs and Goblins", "core", "WFB", "Company1", 10, "painted", \ "www.example.com", null, "Fun!"]' assert model.view(paint) == '[2, "paint", "Paint2", "green", \ "matte", "Company1", 1, "www.example.com", "Fun!"]' # Set up DB for test run gestalt.setuptestdb()
'status': 'painted', 'link': 'www.example.com', 'image': None, 'notes': 'Fun!' }) paint = json.dumps({ 'ID': None, 'kind': 'paint', 'name': 'Paint2', 'color': 'green', 'type': 'matte', 'company': 'Company1', 'quantity': 1, 'link': 'www.example.com', 'notes': 'Fun!' }) assert model.view(game) == '[2, "game", "Game2", "Company1", 1, \ 4, 10, 30, "www.example.com", null, "Fun!"]' assert model.view(mini) == '[2, "mini", "Mini2", \ "Orcs and Goblins", "core", "WFB", "Company1", 10, "painted", \ "www.example.com", null, "Fun!"]' assert model.view(paint) == '[2, "paint", "Paint2", "green", \ "matte", "Company1", 1, "www.example.com", "Fun!"]' # Set up DB for test run gestalt.setuptestdb()
def test_setuptestdb(): exampledb = gestalt.setuptestdb() assert json.loads(exampledb)[0] == 'BEGIN TRANSACTION;' assert json.loads(exampledb)[-1] == 'COMMIT;'