def test_edit_item_save_load(tmpdir): # self._remove_test_dir(self._get_test_file("test_store2")) k = KanbanDirectoryStore() k.add_item({'descr': "a small test item"}) k.add_item({'descr': "a second test item"}) k.set_item(1, {'descr': "an edited item"}) k.save(pathlib.Path(tmpdir) / 'test_store2') k = KanbanDirectoryStore() k.load(pathlib.Path(tmpdir) / 'test_store2') assert k.items()[1].get('descr') == "an edited item" assert k.items()[1].get('id') == 1
def test_load_kanban_board(test_file): k = KanbanDirectoryStore() k.load(test_file("test_store1")) b = k.get_board() assert b['show_statuses'] == ['READY', 'DOING', 'DONE'] assert b['plugins'] == ['testplugin']
def test_save_without_path(): k = KanbanDirectoryStore() k.add_item({'descr': "a small test item"}) with pytest.raises(Exception) as e: k.save()
def test_edit_item(): k = KanbanDirectoryStore() k.add_item({'descr': "a small test item"}) item = k.get_item(0) k.set_item(0, {'descr': "an edited item"}) assert k.items()[0].get('descr') == "an edited item"
def test_add_item_save_then_load(tmpdir): k = KanbanDirectoryStore() k.add_item({'descr': "a small test item"}) k.save(pathlib.Path(tmpdir) / 'test_store2') k = KanbanDirectoryStore() k.load(pathlib.Path(tmpdir) / 'test_store2') assert len(k.items()) == 1 assert k.items()[0].get('descr') == "a small test item" assert k.items()[0].get('id') == 0
def test_add_item(): k = KanbanDirectoryStore() k.add_item({'descr': "a small test item"}) assert len(k.items()) == 1 assert k.items()[0].get('descr') == "a small test item" assert k.items()[0].get('id') == 0
def test_load_empty_store(test_file): k = KanbanDirectoryStore() k.load(test_file("test_store_empty")) assert k.items() == []
def test_load_store(test_file): k = KanbanDirectoryStore() k.load(test_file("test_store1")) assert len(k.items()) == 3 assert [x['id'] for x in k.items()] == [0, 2, 3]
def test_empty_store(): k = KanbanDirectoryStore() assert k.items() == []