def teste_projeto_update_banco(self): proj = Projeto('projeto', 10, 1) proj.insertBanco() proj.changeName("projeto_changed") query = banco.selectAll('projetos') expected = [(1, 10, 'projeto_changed')] self.assertTrue(expected == query)
def teste_banco_update_projeto(self): banco.insertProjeto("ProjetoInalterado", 1) banco.updateProjeto(1, "ProjetoAlterado") query = banco.selectAll('projetos') unchanged = [(1, 1, "ProjetoInalterado")] expected = [(1, 1, "ProjetoAlterado")] self.assertFalse(query == unchanged) self.assertTrue(query == expected)
def teste_tarefas_insertBanco(self): t1 = Tarefa(1, "t1", "d1", False) t1.insertBanco() returned = banco.selectAll("tarefas") expected = [(1, 1, 't1', 'd1', False)] self.assertTrue(returned == expected)
def teste_estorias_insertBanco(self): e1 = Estoria("e1", "d1", 1) e1.insertBanco() returned = banco.selectAll("estorias") expected = [(1, 1, 'e1', 'd1', -1)] self.assertTrue(returned == expected)
def teste_banco_selectAll(self): banco.insertEstoria(1, "e1", "d1", 20) banco.insertTarefa(1, "t1", "d2", False) banco.insertTarefa(1, "t2", "d3", False) banco.insertEstoria(2, "e2", "d4", 20) banco.insertTarefa(2, "t3", "d5", False) estoriasReturned = banco.selectAll("estorias") tarefasReturned = banco.selectAll("tarefas") estoriasExpected = [(1, 1, 'e1', 'd1', 20), (2, 2, 'e2', 'd4', 20)] tarefasExpected = [(1, 1, 't1', 'd2', False), (2, 1, 't2', 'd3', False), (3, 2, 't3', 'd5', False)] self.assertTrue(estoriasReturned == estoriasExpected and tarefasReturned == tarefasExpected)
def teste_estorias_deleteBanco(self): e1 = Estoria("e1", "d1", 1) e1.insertBanco() e1.deleteBanco() returned = banco.selectAll("estorias") self.assertTrue(len(returned) == 0)
def teste_tarefas_deleteBanco(self): t1 = Tarefa(1, "t1", "d2", False) t1.insertBanco() t1.deleteBanco() returned = banco.selectAll("tarefas") self.assertTrue(len(returned) == 0)
def teste_banco_delete_by_id(self): banco.insertProjeto("Projeto", 1) banco.insertProjeto("Projeto2", 1) query = banco.deleteByID('projetos', 1) query = banco.selectAll('projetos') wrong_delete = [(1, 1, "Projeto")] not_delete = [(1, 1, "Projeto"), (2, 1, "Projeto2")] expected = [(2, 1, "Projeto2")] self.assertTrue(query == expected) self.assertFalse(query == not_delete) self.assertFalse(query == wrong_delete)
def teste_tarefas_updateBanco(self): t1 = Tarefa(1, "t1", "d2", False) t1.insertBanco() t1.nome = "T1" t1.descricao = "D2" t1.done = True t1.updateBanco() returned = banco.selectAll("tarefas") self.assertTrue(returned[0][2] == 'T1' and returned[0][3] == 'D2' and returned[0][4])
def teste_estorias_updateBanco(self): e1 = Estoria("e1", "d1", 1) e1.insertBanco() e1.nome = "T1" e1.descricao = "D2" e1.story_points = 8 e1.updateBanco() returned = banco.selectAll("estorias") self.assertTrue(returned[0][2] == 'T1' and returned[0][3] == 'D2' and returned[0][4] == 8)
def teste_banco_insert_projeto(self): banco.insertProjeto("ProjetoBacana", 1) query = banco.selectAll('projetos') expected = [(1, 1, "ProjetoBacana")] self.assertTrue(query == expected)