diff --git a/test/integration_test.py b/test/integration_test.py index 953d167bb..23e81bccc 100644 --- a/test/integration_test.py +++ b/test/integration_test.py @@ -126,6 +126,9 @@ IndexExistsAndDiffersException, IndexService, ) +from azul.json_freeze import ( + freeze, +) from azul.logging import ( configure_test_logging, get_test_logger, @@ -1572,6 +1575,29 @@ def test_compact_manifest(expected_bundles): # Without credentials, only the public bundle should be represented test_compact_manifest({public_bundle}) + def dump_verbatim_manifest(bundles: Iterable[str]) -> set[str]: + manifest_url = furl(url=endpoint, path='/manifest/files', args={ + 'catalog': catalog, + 'format': ManifestFormat.verbatim_jsonl.value, + 'filters': json.dumps({special_fields.bundle_uuid: {'is': list(bundles)}}) + }) + manifest_lines = BytesIO(self._get_url_content(PUT, manifest_url)).readlines() + manifest_content = { + freeze(json.loads(replica)) + for replica in manifest_lines + } + self.assertEqual(len(manifest_lines), len(manifest_content)) + return manifest_content + + for format in ManifestFormat.verbatim_jsonl, ManifestFormat.verbatim_pfb: + if format in metadata_plugin.manifest_formats: + with self.subTest(format=format): + unauthorized = dump_verbatim_manifest(all_bundles) + with self._service_account_credentials: + authorized = dump_verbatim_manifest(all_bundles) + private_only = dump_verbatim_manifest(managed_access_bundles) + self.assertSetEqual(private_only, authorized - unauthorized) + 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