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 Mar 29, 2024
1 parent 6d63b4f commit 52cb2f6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/unit/data/data_access/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ def is_private(self, object):
def verify_items(items1, length, items2=None):
assert len(items1) == length
if items2:
assert set(items2) == set(i for i in items1)
assert set(items2) == set(items1)
2 changes: 2 additions & 0 deletions test/unit/data/data_access/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from galaxy import model as m
from galaxy.datatypes.registry import Registry as DatatypesRegistry
from galaxy.model.triggers.update_audit_table import install as install_timestamp_triggers
from . import MockObjectStore

# utility fixtures
Expand Down Expand Up @@ -38,6 +39,7 @@ def setup(engine):
datatypes_registry = DatatypesRegistry()
datatypes_registry.load_datatypes()
m.set_datatypes_registry(datatypes_registry)
install_timestamp_triggers(engine)
print("\nSETUP CALLED")


Expand Down
21 changes: 20 additions & 1 deletion test/unit/data/data_access/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,26 @@ def test_username_is_unique(self, make_user):
make_user(username="a")


# replacing test_galaxy_mapping.py
def test_history_update(make_history, make_hda, session):
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(
Expand Down

0 comments on commit 52cb2f6

Please sign in to comment.