Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jrolle committed Dec 6, 2023
1 parent 09e91a9 commit 541a8c7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/sqlite/models/test_sqlite_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,23 @@ def test_can_find_list(self):
sql, """SELECT * FROM "users" WHERE "users"."id" IN ('1','2','3')"""
)

def test_find_or_if_record_not_found(self):
# Insane record number so record cannot be found
record_id = 1_000_000_000_000_000

result = User.find_or(record_id, lambda: "Record not found.")
self.assertEqual(
result, "Record not found."
)

def test_find_or_if_record_found(self):
record_id = 1
result_id = User.find_or(record_id, lambda: "Record not found.").id

self.assertEqual(
result_id, record_id
)

def test_can_set_and_retreive_attribute(self):
user = User.hydrate({"id": 1, "name": "joe", "customer_id": 1})
user.customer_id = "CUST1"
Expand Down

0 comments on commit 541a8c7

Please sign in to comment.