コード例 #1
0
ファイル: test_manifest.py プロジェクト: pieska/pulp
 def test_write(self):
     # Test
     manifest = Manifest()
     units = []
     for i in range(0, self.NUM_UNITS):
         units.append({i:i+1})
     manifest.write(self.tmp_dir, units)
     # Verify
     path = os.path.join(self.tmp_dir, Manifest.FILE_NAME)
     self.assertTrue(os.path.exists(path))
     fp = gzip.open(path)
     s = fp.read()
     units_in = json.loads(s)
     self.verify(units, units_in)
コード例 #2
0
ファイル: test_manifest.py プロジェクト: pieska/pulp
 def test_round_trip(self):
     # Test
     manifest = Manifest()
     units = []
     for i in range(0, self.NUM_UNITS):
         units.append({i:i+1})
     manifest.write(self.tmp_dir, units)
     cfg = DownloaderConfig('http')
     downloader = factory.get_downloader(cfg)
     manifest = Manifest()
     path = os.path.join(self.tmp_dir, Manifest.FILE_NAME)
     url = 'file://%s' % path
     units_in = manifest.read(url, downloader)
     # Verify
     self.verify(units, units_in)
コード例 #3
0
ファイル: publisher.py プロジェクト: pieska/pulp
 def write_manifest(self, units):
     """
     Write the manifest (units.json) for the specified list of units.
     :param units: A list of units.
     :type units: list
     :return: The absolute path to the written manifest file.
     :rtype: str
     """
     manifest = Manifest()
     dir_path = join(self.publish_dir, self.repo_id)
     mkdir(dir_path)
     return manifest.write(dir_path, units)