From 9332d49a995afdfa37f8723bb1c017fd216b230a Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Sat, 3 Jul 2021 09:42:25 -0400 Subject: [PATCH] Revert "Merge pull request #386 from dandi/workaround-no-summary" This reverts commit 93faf5ff2942e800bf9093b4a709c7c566ad3b1d, reversing changes made to da32e0e6c550100a6dd8529aa68484957a710e42. --- dandiapi/api/models/version.py | 4 +--- dandiapi/api/tests/test_tasks.py | 3 --- dandiapi/api/tests/test_version.py | 4 ---- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/dandiapi/api/models/version.py b/dandiapi/api/models/version.py index 18cb9879e..c70b97342 100644 --- a/dandiapi/api/models/version.py +++ b/dandiapi/api/models/version.py @@ -274,9 +274,7 @@ def _populate_metadata(self, version_with_assets: Version = None): 'numberOfBytes': 0, 'numberOfFiles': 0, } - # TODO: remove the `and False` and find a better way to handle the - # unconditional recomputation of the summary stats. - if version_with_assets.id and False: + if version_with_assets.id: try: summary = aggregate_assets_summary( [asset.metadata.metadata for asset in version_with_assets.assets.all()] diff --git a/dandiapi/api/tests/test_tasks.py b/dandiapi/api/tests/test_tasks.py index 142a36293..55546cffb 100644 --- a/dandiapi/api/tests/test_tasks.py +++ b/dandiapi/api/tests/test_tasks.py @@ -199,7 +199,6 @@ def test_validate_asset_metadata_malformed_keywords(asset: Asset): ) -@pytest.mark.skip(reason='https://github.com/dandi/dandi-api/pull/386') @pytest.mark.django_db def test_validate_version_metadata(version: Version, asset: Asset): version.assets.add(asset) @@ -242,7 +241,6 @@ def test_validate_version_metadata_malformed_schema_version(version: Version, as assert version.validation_error.startswith('Metadata version xxx is not allowed.') -@pytest.mark.skip(reason='https://github.com/dandi/dandi-api/pull/386') @pytest.mark.django_db def test_validate_version_metadata_no_description(version: Version, asset: Asset): version.assets.add(asset) @@ -262,7 +260,6 @@ def test_validate_version_metadata_no_description(version: Version, asset: Asset ) -@pytest.mark.skip(reason='https://github.com/dandi/dandi-api/pull/386') @pytest.mark.django_db def test_validate_version_metadata_malformed_license(version: Version, asset: Asset): version.assets.add(asset) diff --git a/dandiapi/api/tests/test_version.py b/dandiapi/api/tests/test_version.py index e53339b17..ded2dc660 100644 --- a/dandiapi/api/tests/test_version.py +++ b/dandiapi/api/tests/test_version.py @@ -30,7 +30,6 @@ def test_version_make_version_save(mocker, dandiset, published_version_factory): assert version_1.version != version_str_2 -@pytest.mark.skip(reason='https://github.com/dandi/dandi-api/pull/386') @pytest.mark.django_db def test_version_metadata_computed(version, version_metadata): original_metadata = version_metadata.metadata @@ -353,7 +352,6 @@ def test_version_rest_info_with_asset( } -@pytest.mark.skip(reason='https://github.com/dandi/dandi-api/pull/386') @pytest.mark.django_db def test_version_rest_update(api_client, user, draft_version): assign_perm('owner', user, draft_version.dandiset) @@ -409,7 +407,6 @@ def test_version_rest_update(api_client, user, draft_version): assert draft_version.metadata.name == new_name -@pytest.mark.skip(reason='https://github.com/dandi/dandi-api/pull/386') @pytest.mark.django_db def test_version_rest_update_large(api_client, user, draft_version): assign_perm('owner', user, draft_version.dandiset) @@ -500,7 +497,6 @@ def test_version_rest_update_not_an_owner(api_client, user, version): ) -@pytest.mark.skip(reason='https://github.com/dandi/dandi-api/pull/386') @pytest.mark.django_db # TODO change admin_user back to a normal user once publish is allowed def test_version_rest_publish(api_client, admin_user: User, draft_version: Version, asset: Asset):