Skip to content
Snippets Groups Projects
Commit 21f3ac13 authored by morkolai's avatar morkolai
Browse files

#52 Test for fylling av data og format

parent 95467582
No related branches found
No related tags found
1 merge request!27#52 Automatisk oppdatering av kodebok basert på tid
Pipeline #73855 passed
......@@ -105,6 +105,16 @@ class DatabaseTest(unittest.TestCase):
self.assertRegex(actual[i][2], "[A-Z]{" + str(code_len) + "}")
self.assertEqual(entry["type"], actual[i][3])
def test_last_updated(self):
"""Assert table LastUpdated is filled when db is created."""
stmt = "SELECT Timestamp FROM LastUpdated"
# [:19] to skip microseconds
last_update = self.database.conn.execute(stmt).fetchall()[0][0][:19]
# Using raw string to not make backslash escape character
self.assertRegex(
last_update, r"(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})"
)
def test_get_categories(self):
"""Assert function get_categories works as expected."""
file_path = os.path.join(TESTDATA_PATH, "CategoryWords.txt")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment