Skip to content

Commit

Permalink
✅ 🤡 init unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
agn-7 committed Nov 18, 2023
1 parent 7dcf024 commit a34cf48
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/test_crud.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from datetime import datetime

from ifsguid import crud, models, utils, schemas


### Unit Tests ###


def test_get_interactions(db):
timestamp = utils.convert_timezone(datetime.now())
interaction1 = models.Interaction(
settings=dict(model_name="model1", role="role1", prompt="prompt1"),
created_at=timestamp,
updated_at=timestamp,
)
interaction2 = models.Interaction(
settings=dict(model_name="model2", role="role2", prompt="prompt2"),
created_at=timestamp,
updated_at=timestamp,
)
db.add(interaction1)
db.add(interaction2)
db.commit()

interactions = crud.get_interactions(db)
assert len(interactions) == 2
assert interactions[0].settings["model_name"] == "model1"
assert interactions[1].settings["model_name"] == "model2"


0 comments on commit a34cf48

Please sign in to comment.