From ba1b8b07446e457d051ef1902176bb1b01cd39f2 Mon Sep 17 00:00:00 2001 From: Noa Aviel Dove Date: Wed, 3 Apr 2024 21:38:57 -0700 Subject: [PATCH] Extract variables; rename nested function --- test/integration_test.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/integration_test.py b/test/integration_test.py index c849abc25..b1b25a089 100644 --- a/test/integration_test.py +++ b/test/integration_test.py @@ -1518,7 +1518,8 @@ def _test_managed_access_manifest(self, """ endpoint = config.service_endpoint - special_fields = self.metadata_plugin(catalog).special_fields + metadata_plugin = self.metadata_plugin(catalog) + special_fields = metadata_plugin.special_fields def bundle_uuids(hit: JSON) -> set[str]: return { @@ -1546,7 +1547,7 @@ def bundle_uuids(hit: JSON) -> set[str]: params = {'catalog': catalog, 'filters': json.dumps(filters)} manifest_url = furl(url=endpoint, path='/manifest/files', args=params) - def assert_manifest(expected_bundles): + def test_compact_manifest(expected_bundles): manifest = BytesIO(self._get_url_content(PUT, manifest_url)) manifest_rows = self._read_csv_manifest(manifest) all_found_bundles = set() @@ -1562,15 +1563,16 @@ def assert_manifest(expected_bundles): all_found_bundles.update(found_bundles) self.assertEqual(expected_bundles, all_found_bundles) + all_bundles = {public_bundle, *managed_access_bundles} # With authorized credentials, all bundles included in the filters # should be represented in the manifest with self._service_account_credentials: - assert_manifest({public_bundle, *managed_access_bundles}) + test_compact_manifest(all_bundles) # Without credentials, only the public bundle should be represented - assert_manifest({public_bundle}) + test_compact_manifest({public_bundle}) - if ManifestFormat.curl in self.metadata_plugin(catalog).manifest_formats: + if ManifestFormat.curl in metadata_plugin.manifest_formats: # Create a single-file curl manifest and verify that the OAuth2 # token is present on the command line managed_access_file_id = one(self.random.choice(files)['files'])['uuid']