Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into fix-untitled-projects

* 'develop' of https://github.com/CenterForOpenScience/osf.io:
  fix(test): do not assume order where there is none
  • Loading branch information
John Tordoff committed Sep 27, 2023
2 parents 7414593 + 943dc72 commit c182e29
Showing 1 changed file with 8 additions and 27 deletions.
35 changes: 8 additions & 27 deletions api_tests/files/views/test_file_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,11 @@ def test_disambiguate_dataverse_paths_initial(self, app, user, node, dataverse):
)
data = res.json['data']
assert len(data) == 2
assert data[0]['attributes']['extra'] == {
'datasetVersion': 'latest',
'hashes': {
'md5': None,
'sha256': None
}
}
assert data[1]['attributes']['extra'] == {
'datasetVersion': 'latest-published',
'hashes': {
'md5': None,
'sha256': None
}
dataset_versions = {
_datum['attributes']['extra']['datasetVersion']
for _datum in data
}
assert dataset_versions == {'latest', 'latest-published'}

@responses.activate
def test_disambiguate_dataverse_paths_retrieve(self, app, user, node, dataverse, dataverse_draft_filenode, dataverse_published_filenode):
Expand All @@ -155,7 +146,6 @@ def test_disambiguate_dataverse_paths_retrieve(self, app, user, node, dataverse,
'path': '/testpath',
'materialized': '/testpath',
'kind': 'file',

'extra': {
'datasetVersion': 'latest',
},
Expand All @@ -179,20 +169,11 @@ def test_disambiguate_dataverse_paths_retrieve(self, app, user, node, dataverse,
)
data = res.json['data']
assert len(data) == 2
assert data[0]['attributes']['extra'] == {
'datasetVersion': 'latest',
'hashes': {
'md5': None,
'sha256': None
}
}
assert data[1]['attributes']['extra'] == {
'datasetVersion': 'latest-published',
'hashes': {
'md5': None,
'sha256': None
}
dataset_versions = {
_datum['attributes']['extra']['datasetVersion']
for _datum in data
}
assert dataset_versions == {'latest', 'latest-published'}


@pytest.mark.django_db
Expand Down

0 comments on commit c182e29

Please sign in to comment.