Skip to content

Commit

Permalink
poistojen testailua
Browse files Browse the repository at this point in the history
  • Loading branch information
StarlineOutwood committed Dec 8, 2023
1 parent f8b508b commit 88579fa
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/tests/repositories/test_cite_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,24 @@ def test_remove_cite_only_removes_one_cite(self):
self.assertEqual(len(cite_data), 1)
self.assertEqual(len(authors), 1)
self.assertEqual(len(fields), 1)

def test_remove_all_cites(self):
self.repository.add_cite(
Cite("amazingBook", "book", ["Ama Zing"], {"title": "An amazing book"})
)
self.repository.add_cite(
Cite("goodBook", "book", ["Good Book"], {"title": "A good book"})
)
self.repository.remove_cite("amazingBook")

self.repository.remove_all_cites()

cite_data = database.cursor.execute("SELECT * FROM Cites").fetchall()
authors = database.cursor.execute("SELECT * FROM Authors").fetchall()
fields = database.cursor.execute("SELECT * FROM Fields").fetchall()

self.assertEqual(len(cite_data), 0)
self.assertEqual(len(authors), 0)
self.assertEqual(len(fields), 0)


4 changes: 4 additions & 0 deletions src/tests/services/test_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ def test_filter_cites_calls_filter_by_name_when_name_searched(self):
def test_remove_cite(self):
self.logic.remove_cite("123")
self.repository_mock.remove_cite.assert_called()

def test_remova_all_cites(self):
self.logic.remove_all_cites()
self.repository_mock.remove_all_cites.assert_called()

0 comments on commit 88579fa

Please sign in to comment.