Skip to content

Commit

Permalink
Use version in the portal URL
Browse files Browse the repository at this point in the history
  • Loading branch information
BenGalewsky committed Feb 6, 2024
1 parent 035e2e4 commit 89e677a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion aws/automate_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def submit(self, mdf_rec, organization,
assert destination_parsed.scheme == 'globus'

automate_rec = {
"mdf_portal_link": self.portal_url+mdf_rec["mdf"]["source_id"],
"mdf_portal_link": self.portal_url+mdf_rec["mdf"]["versioned_source_id"],
"user_transfer_inputs": self.create_transfer_items(
data_sources=data_sources,
organization=organization,
Expand Down
5 changes: 4 additions & 1 deletion aws/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ def mdf_rec():
},
],
},
"mdf": {"source_id": "123-456-7890", "version": "1.0.1"},
"mdf": {"source_id": "123-456-7890",
"version": "1.0.1",
"versioned_source_id": "123-456-7890-1.0.1"
}
}


Expand Down
25 changes: 24 additions & 1 deletion aws/tests/test_automate_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def test_update_metadata_only(self, mock_automate, secrets, organization, mocker


@mock.patch('automate_manager.GlobusAutomateFlow', autospec=True)
def test_mint_doi(self, mock_automate, secrets, organization_mint_doi, mocker, mdf_rec):
def test_mint_doi(self, mock_automate, secrets, organization_mint_doi, mocker, mdf_rec, set_environ):
mock_flow = mocker.Mock()
mock_automate.from_existing_flow = mocker.Mock(return_value=mock_flow)
os.environ['PORTAL_URL'] = "https://acdc.alcf.anl.gov/mdf/detail/"
Expand Down Expand Up @@ -228,3 +228,26 @@ def test_mint_doi(self, mock_automate, secrets, organization_mint_doi, mocker, m
mock_flow.run_flow.assert_called()
assert(mock_flow.run_flow.call_args[0][0]['mint_doi'])

@mock.patch('automate_manager.GlobusAutomateFlow', autospec=True)
def test_mdf_portal_link(self, mock_automate, secrets, organization_mint_doi, mocker, mdf_rec, set_environ):
mock_flow = mocker.Mock()
mock_automate.from_existing_flow = mocker.Mock(return_value=mock_flow)
os.environ['PORTAL_URL'] = "https://acdc.alcf.anl.gov/mdf/detail/"
manager = AutomateManager(secrets, is_test=True)

data_sources = [
"https://app.globus.org/file-manager?destination_id=e38ee745-6d04-11e5-ba46-22000b92c6ec&destination_path=%2FMDF%2Fmdf_connect%2Ftest_files%2Fcanonical_datasets%2Fdft%2F"
]
user_token = {'access_token': '1234567890'}
_ = manager.submit(mdf_rec=mdf_rec, organization=organization_mint_doi,
submitting_user_token=user_token,
submitting_user_id="12-33-55", monitor_by_id=["12-33-55",
"5fc63928-3752-11e8-9c6f-0e00fd09bf20"],
submitting_user_email="[email protected]",
search_index_uuid='098-765-4321',
data_sources=data_sources, is_test=False,
update_metadata_only=False)

mock_flow.run_flow.assert_called()
assert(mock_flow.run_flow.call_args[0][0]['mdf_portal_link'] == "https://acdc.alcf.anl.gov/mdf/detail/123-456-7890-1.0.1")

0 comments on commit 89e677a

Please sign in to comment.