Lines Matching refs:catalog
43 import pkg.catalog as catalog
52 """Tests for all catalog functionality."""
59 self.c = catalog.Catalog(log_updates=True)
443 # Test new catalog case.
445 c = catalog.Catalog(meta_root=cpath, log_updates=True)
454 # Now test old catalog case.
457 c = catalog.Catalog(meta_root=cpath, log_updates=True)
463 # since this causes the catalog file to be re-created.
472 # Finally, test read_only old catalog case.
477 catalog.Catalog, meta_root=c.meta_root, read_only=True)
480 """Test catalog storage, retrieval, and validation."""
483 c = catalog.Catalog(meta_root=cpath, log_updates=True)
485 # Verify that a newly created catalog has no signature data.
489 # Verify that a newly created catalog will validate since no
493 # Verify catalog storage and retrieval works.
501 # Verify that a catalog will have signature data after save().
505 self.assertTrue("catalog.attrs" in old_sigs)
506 self.assertTrue("catalog.base.C" in old_sigs)
518 # Verify that the newly saved catalog will validate.
521 # Next, retrieve the stored catalog.
522 c = catalog.Catalog(meta_root=cpath, log_updates=True)
527 # Verify that a stored catalog will validate, and that its
532 # Finally, test that a catalog created with sign=False won't
534 c = catalog.Catalog(sign=False)
536 self.assertEqual(c.signatures, { "catalog.attrs": {} })
539 """Verify that various catalog retrieval methods work as
714 """Verify that catalog operations work as expected."""
716 # Three sample packages used to verify that catalog data
742 # Create and prep an empty catalog.
744 cat = catalog.Catalog(meta_root=cpath, log_updates=True)
746 # Populate the catalog and then verify the Manifest signatures
778 # Next, verify that removal of an FMRI not in the catalog will
786 # the last_modified timestamp of the catalog and base part.
787 base = cat.get_part("catalog.base.C")
806 """Verify that catalog updates are applied as expected."""
808 # First, start by creating and populating the original catalog.
810 orig = catalog.Catalog(meta_root=cpath, log_updates=True)
816 dup1 = catalog.Catalog(meta_root=dup1_path)
819 # No catalog updates should be needed.
832 # Check the expected number of package versions in each catalog.
836 # Only the new catalog parts should be listed as updates.
838 self.assertEqual(updates, set(["catalog.base.C"]))
840 # Now copy the existing catalog so that a baseline exists for
851 # catalog are the same as the updated needed to update
855 # Apply original catalog's updates to the duplicate.
877 dup1 = catalog.Catalog(meta_root=dup1_path)
920 # First, populate a new catalog with the entries from the test
922 c = catalog.Catalog()
927 nc = catalog.Catalog()
960 nc = catalog.Catalog()
998 """Verify that the actions-related catalog functions work as
1020 # Create a catalog and populate it using FMRIs and Manifests.
1021 nc = catalog.Catalog()
1026 # Create a catalog and populate it using only FMRIs.
1027 nc = catalog.Catalog()
1060 # Create a catalog and populate it using only FMRIs.
1062 nc = catalog.Catalog(meta_root=cpath)
1066 # Now verify that destroy really destroys the catalog.
1069 # Verify that destroy actually emptied the catalog.
1074 self.assertEqual(nc.signatures, { "catalog.attrs": {} })
1076 # Next, re-create the catalog and then delete a few arbitrary
1079 nc = catalog.Catalog(meta_root=cpath)
1085 for fname in ("catalog.attrs", "catalog.dependency.C",
1086 "catalog.summary.C"):
1091 nc = catalog.Catalog(meta_root=cpath)
1095 self.assertFalse(fname.startswith("catalog.") or \
1110 nc = catalog.Catalog()
1122 self.c = catalog.Catalog()
1146 """Raise InvalidCatalogFile for a catalog.attrs w/ bogus JSON"""
1147 f = open(os.path.join(self.test_root, "catalog.attrs"), "w")
1148 f.write('{"valid json": "but not a catalog"}')
1151 catalog.Catalog, meta_root=self.test_root)
1154 """Raise InvalidCatalogFile for a catalog.attrs w/ garbage"""
1155 f = open(os.path.join(self.test_root, "catalog.attrs"), "w")
1159 catalog.Catalog, meta_root=self.test_root)
1162 """Raise InvalidCatalogFile for a catalog.attrs missing an
1164 # make catalog
1165 c = catalog.Catalog(meta_root=self.test_root)
1169 fname = os.path.join(self.test_root, "catalog.attrs")
1179 catalog.Catalog, meta_root=self.test_root)
1182 """Raise BadCatalogSignatures for a catalog.attrs with
1184 # make catalog
1185 c = catalog.Catalog(meta_root=self.test_root)
1189 fname = os.path.join(self.test_root, "catalog.attrs")
1200 c = catalog.Catalog(meta_root=self.test_root)
1207 """Raise BadCatalogSignatures for a catalog.attrs with
1209 # make catalog
1210 c = catalog.Catalog(meta_root=self.test_root)
1214 fname = os.path.join(self.test_root, "catalog.attrs")
1223 c = catalog.Catalog(meta_root=self.test_root)
1230 """Raise UnrecognizedCatalogPart for a catalog.attrs{parts}
1232 # make catalog
1233 c = catalog.Catalog(meta_root=self.test_root)
1237 fname = os.path.join(self.test_root, "catalog.attrs")
1248 catalog.Catalog, meta_root=self.test_root)
1251 """Raise UnrecognizedCatalogPart for a catalog.attrs{parts}
1255 croot = os.path.join(self.test_root, "file_root", "catalog")
1258 # make catalog
1259 c = catalog.Catalog(meta_root=croot, file_root=file_root)
1262 # Test catalog.attrs{parts} by adding a symbolic link to
1265 for name in ["link", "shadow", "catalog.foo", "update.bar"]:
1272 fname = os.path.join(croot, "catalog.attrs")
1281 catalog.Catalog, meta_root=croot,
1292 """Raise UnrecognizedCatalogPart for a catalog.attrs file
1297 croot = os.path.join(self.test_root, "file_root", "catalog")
1300 # make catalog
1301 c = catalog.Catalog(meta_root=croot, file_root=file_root)
1305 # Make catalog.attrs being a symlink to reference a file
1308 attrs = os.path.join(croot, "catalog.attrs")
1317 catalog.Catalog, meta_root=croot,