diff options
author | Julien Dessaux | 2021-10-29 21:13:53 +0200 |
---|---|---|
committer | Julien Dessaux | 2021-10-29 21:13:53 +0200 |
commit | 785ef2a9135281e4ec67662ef60c27a320f22b9b (patch) | |
tree | ebe8917b9c192b80baff8879d951474fa209d783 /tests | |
parent | Added gitignore (diff) | |
download | short-785ef2a9135281e4ec67662ef60c27a320f22b9b.tar.gz short-785ef2a9135281e4ec67662ef60c27a320f22b9b.tar.bz2 short-785ef2a9135281e4ec67662ef60c27a320f22b9b.zip |
Changed for a better way to generate uuids
Diffstat (limited to 'tests')
-rw-r--r-- | tests/database.nim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/database.nim b/tests/database.nim index 6fa47c5..3ebbcca 100644 --- a/tests/database.nim +++ b/tests/database.nim @@ -11,7 +11,7 @@ suite "database": let db = openDatabase(":memory:") check db.Migrate() == true let u = ShortUrl( - Token: "token", + Token: parseUUID("ca69c4b5-75a7-4acc-8384-316d41ef59c7"), Title: "title", Url: "url", Created: testingNow, @@ -25,17 +25,17 @@ suite "database": discard var u2 = db.GetUrl(u.Token) check u2.ID == 1 - check u2.Token == "token" + check u2.Token == u.Token check u2.Title == "title" check u2.Url == "url" check u2.Created - testingNow < someTime check u2.Expires - later < someTime db.CleanExpired() try: - discard db.GetUrl("token") + discard db.GetUrl(u.Token) except SqliteError: check false u2.Expires = testingNow + 120 * someTime db.AddUrl(u2[]) db.CleanExpired() - check db.GetUrl("token") != nil + check db.GetUrl(u.Token) != nil |