Skip to content

Commit

Permalink
Refactor tests to reduce duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Sep 21, 2024
1 parent 600523b commit 4471c6a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
10 changes: 10 additions & 0 deletions test/unit/data/model/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
PRIVATE_OBJECT_STORE_ID = "my_private_data"


class MockObjectStore:

def is_private(self, object):
if object.object_store_id == PRIVATE_OBJECT_STORE_ID:
return True
else:
return False
11 changes: 0 additions & 11 deletions test/unit/data/model/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,9 @@
namedtuple,
)

PRIVATE_OBJECT_STORE_ID = "my_private_data"

MockTransaction = namedtuple("MockTransaction", "user")


class MockObjectStore:

def is_private(self, object):
if object.object_store_id == PRIVATE_OBJECT_STORE_ID:
return True
else:
return False


def verify_items(items, expected_items):
"""
Assert that items and expected_items contain the same elements.
Expand Down
2 changes: 1 addition & 1 deletion test/unit/data/model/db/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,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
from .. import MockObjectStore

if TYPE_CHECKING:
from sqlalchemy.engine import Engine
Expand Down
6 changes: 2 additions & 4 deletions test/unit/data/model/db/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@

from galaxy import model as m
from galaxy.model.unittest_utils.db_helpers import get_hdca_by_name
from . import (
MockTransaction,
PRIVATE_OBJECT_STORE_ID,
)
from . import MockTransaction
from .. import PRIVATE_OBJECT_STORE_ID


def test_history_update(make_history, make_hda, session):
Expand Down

0 comments on commit 4471c6a

Please sign in to comment.