forked from galaxyproject/galaxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests SQLAlchemy, user-history relationship mapping
- Loading branch information
Showing
1 changed file
with
0 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -211,49 +211,6 @@ def test_nested_collection_attributes(self): | |
] | ||
assert c4.dataset_elements == [dce1, dce2] | ||
|
||
def test_basic(self): | ||
original_user_count = len(self.model.session.scalars(select(model.User)).all()) | ||
|
||
# Make some changes and commit them | ||
u = model.User(email="[email protected]", password="password") | ||
h1 = model.History(name="History 1", user=u) | ||
h2 = model.History(name=("H" * 1024)) | ||
self.persist(u, h1, h2) | ||
metadata = dict(chromCol=1, startCol=2, endCol=3) | ||
d1 = model.HistoryDatasetAssociation( | ||
extension="interval", metadata=metadata, history=h2, create_dataset=True, sa_session=self.model.session | ||
) | ||
self.persist(d1) | ||
|
||
# Check | ||
users = self.model.session.scalars(select(model.User)).all() | ||
assert len(users) == original_user_count + 1 | ||
user = [user for user in users if user.email == "[email protected]"][0] | ||
assert user.email == "[email protected]" | ||
assert user.password == "password" | ||
assert len(user.histories) == 1 | ||
assert user.histories[0].name == "History 1" | ||
hists = self.model.session.scalars(select(model.History)).all() | ||
hist0 = [history for history in hists if history.id == h1.id][0] | ||
hist1 = [history for history in hists if history.id == h2.id][0] | ||
assert hist0.name == "History 1" | ||
assert hist1.name == ("H" * 255) | ||
assert hist0.user == user | ||
assert hist1.user is None | ||
assert hist1.datasets[0].metadata.chromCol == 1 | ||
# The filename test has moved to objectstore | ||
# id = hist1.datasets[0].id | ||
# assert hist1.datasets[0].file_name == os.path.join( "/tmp", *directory_hash_id( id ) ) + f"/dataset_{id}.dat" | ||
# Do an update and check | ||
hist1.name = "History 2b" | ||
self.expunge() | ||
hists = self.model.session.scalars(select(model.History)).all() | ||
hist0 = [history for history in hists if history.name == "History 1"][0] | ||
hist1 = [history for history in hists if history.name == "History 2b"][0] | ||
assert hist0.name == "History 1" | ||
assert hist1.name == "History 2b" | ||
# gvk TODO need to ad test for GalaxySessions, but not yet sure what they should look like. | ||
|
||
def test_metadata_spec(self): | ||
metadata = dict(chromCol=1, startCol=2, endCol=3) | ||
d = model.HistoryDatasetAssociation(extension="interval", metadata=metadata, sa_session=self.model.session) | ||
|