Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mvandenburgh authored and dchiquito committed Jul 30, 2021
1 parent be33ea1 commit c7ab51f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions dandiapi/api/tests/test_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,15 @@ def test_asset_rest_validation(api_client, version, asset, status, validation_er
version.assets.add(asset)

asset.status = status
asset.validation_error = validation_error
asset.validation_errors = validation_error
asset.save()

assert api_client.get(
f'/api/dandisets/{version.dandiset.identifier}/'
f'versions/{version.version}/assets/{asset.asset_id}/validation/'
).data == {
'status': status,
'validation_error': validation_error,
'validation_errors': validation_error,
}


Expand Down
14 changes: 10 additions & 4 deletions dandiapi/api/tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,16 @@ def test_version_rest_info(api_client, version):
@pytest.mark.parametrize(
'asset_status,expected_validation_error',
[
(Asset.Status.PENDING, ['has not been validated']),
(Asset.Status.VALIDATING, ['has not been validated']),
(
Asset.Status.PENDING,
[{'field': '', 'message': 'asset is currently being validated, please wait.'}],
),
(
Asset.Status.VALIDATING,
[{'field': '', 'message': 'asset is currently being validated, please wait.'}],
),
(Asset.Status.VALID, []),
(Asset.Status.INVALID, ['1 invalid asset metadatas']),
(Asset.Status.INVALID, []),
],
)
def test_version_rest_info_with_asset(
Expand All @@ -383,7 +389,7 @@ def test_version_rest_info_with_asset(

# These validation error types should have the asset path prepended to them:
if asset_status == Asset.Status.PENDING or asset_status == Asset.Status.VALIDATING:
expected_validation_error = [f'{asset.path} {expected_validation_error[0]}']
expected_validation_error[0]['field'] = asset.path

assert api_client.get(
f'/api/dandisets/{version.dandiset.identifier}/versions/{version.version}/info/'
Expand Down

0 comments on commit c7ab51f

Please sign in to comment.