コード例 #1
0
ファイル: test_links.py プロジェクト: bartwo/pulp
 def test_list(self):
     # Setup
     path = os.path.join(self.tmp_dir, 'A')
     fp = open(path, 'w')
     fp.write(CONTENT)
     fp.close()
     # Test
     path_out = os.path.join(self.tmp_dir, 'B')
     packed = link.pack(path, path_out)
     lst = [
         {'elmer':packed},
         packed,
         10,
         'stones'
     ]
     self.assertTrue(link.is_link(lst[0]['elmer']))
     self.assertTrue(link.is_link(lst[1]))
     unpacked = link.unpack_all(lst)
     self.assertEqual(unpacked[0]['elmer'], path_out)
     self.assertEqual(unpacked[1], path_out)
     self.assertEqual(unpacked[2], 10)
     self.assertEqual(unpacked[3], 'stones')
     f = open(path_out)
     s = f.read()
     f.close()
     self.assertEqual(s, CONTENT)
コード例 #2
0
ファイル: model.py プロジェクト: kbotc/pulp
 def add(self):
     """
     Add this importer to the child inventory.
     """
     binding = self.binding.repo_importer
     conf = self.details['config']
     conf = link.unpack_all(conf)
     binding.create(self.repo_id, self.imp_id, conf)
     log.info('Importer %s/%s, added', self.repo_id, self.imp_id)
コード例 #3
0
 def merge(self, parent):
     """
     Merge this importer configuration from the parent importer.
     :param parent: The parent repository.
     :type parent: ParentRepository
     """
     configuration = parent.details['config']
     unpacked = link.unpack_all(configuration)
     self.update(unpacked)
コード例 #4
0
 def add(self):
     """
     Add this importer to the child inventory.
     """
     binding = self.binding.repo_importer
     conf = self.details['config']
     conf = link.unpack_all(conf)
     binding.create(self.repo_id, self.imp_id, conf)
     log.info('Importer %s/%s, added', self.repo_id, self.imp_id)
コード例 #5
0
ファイル: model.py プロジェクト: kbotc/pulp
 def merge(self, parent):
     """
     Merge this importer configuration from the parent importer.
     :param parent: The parent repository.
     :type parent: ParentRepository
     """
     delta = {}
     for k,v in parent.details['config'].items():
         if self.details['config'].get(k) != v:
             self.details['config'][k] = v
             delta[k] = v
     if delta:
         delta = link.unpack_all(delta)
         self.update(delta)
コード例 #6
0
 def merge(self, parent):
     """
     Merge this importer configuration from the parent importer.
     :param parent: The parent repository.
     :type parent: ParentRepository
     """
     delta = {}
     for k, v in parent.details['config'].items():
         if self.details['config'].get(k) != v:
             self.details['config'][k] = v
             delta[k] = v
     if delta:
         delta = link.unpack_all(delta)
         self.update(delta)
コード例 #7
0
ファイル: test_links.py プロジェクト: bartwo/pulp
 def test_shallow(self):
     # Setup
     path = os.path.join(self.tmp_dir, 'A')
     fp = open(path, 'w')
     fp.write(CONTENT)
     fp.close()
     # Test
     path_out = os.path.join(self.tmp_dir, 'B')
     packed = link.pack(path, path_out)
     d = {'elmer':packed}
     self.assertTrue(link.is_link(d['elmer']))
     unpacked = link.unpack_all(d)
     self.assertEqual(unpacked['elmer'], path_out)
     f = open(path_out)
     s = f.read()
     f.close()
     self.assertEqual(s, CONTENT)
コード例 #8
0
ファイル: test_links.py プロジェクト: tomlanyon/pulp
 def test_shallow(self):
     # Setup
     path = os.path.join(self.tmp_dir, 'A')
     fp = open(path, 'w')
     fp.write(CONTENT)
     fp.close()
     # Test
     path_out = os.path.join(self.tmp_dir, 'B')
     packed = link.pack(path, path_out)
     d = {'elmer': packed}
     self.assertTrue(link.is_link(d['elmer']))
     unpacked = link.unpack_all(d)
     self.assertEqual(unpacked['elmer'], path_out)
     f = open(path_out)
     s = f.read()
     f.close()
     self.assertEqual(s, CONTENT)
コード例 #9
0
ファイル: test_links.py プロジェクト: tomlanyon/pulp
 def test_list(self):
     # Setup
     path = os.path.join(self.tmp_dir, 'A')
     fp = open(path, 'w')
     fp.write(CONTENT)
     fp.close()
     # Test
     path_out = os.path.join(self.tmp_dir, 'B')
     packed = link.pack(path, path_out)
     lst = [{'elmer': packed}, packed, 10, 'stones']
     self.assertTrue(link.is_link(lst[0]['elmer']))
     self.assertTrue(link.is_link(lst[1]))
     unpacked = link.unpack_all(lst)
     self.assertEqual(unpacked[0]['elmer'], path_out)
     self.assertEqual(unpacked[1], path_out)
     self.assertEqual(unpacked[2], 10)
     self.assertEqual(unpacked[3], 'stones')
     f = open(path_out)
     s = f.read()
     f.close()
     self.assertEqual(s, CONTENT)