Skip to content

Commit

Permalink
Add test_history_update
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Jun 10, 2024
1 parent fd29aab commit 0712fbf
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/unit/data/model/db/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,34 @@
)


def test_history_update(make_history, make_hda, session):
"""
Verify the following behavior:
- history updated due to hda insert
- history updated due to hda update
- history NOT updated when hda copied
"""
h1 = make_history()
old_update_time = h1.update_time

hda = make_hda(history=h1, create_dataset=True, sa_session=session)
# history updated due to hda insert
assert h1.update_time > old_update_time

old_update_time = h1.update_time
hda.name = "new name"
session.add(hda)
session.commit()
# history updated due to hda update
assert h1.update_time > old_update_time

old_update_time = h1.update_time
hda2 = hda.copy()
assert hda2
# history NOT updated when hda copied
assert h1.update_time == old_update_time


def test_ratings(
make_user,
make_stored_workflow,
Expand Down

0 comments on commit 0712fbf

Please sign in to comment.