コード例 #1
0
 def test_version_no_exists(self):
     otree = {'products': {
         'P1': {"F1": "V1"},
         'P2': {'versions': {'VER1': {'X1': 'X2'}}}
     }}
     tree = deepcopy(otree)
     util.products_del(tree, ('P2', 'VER2'))
     self.assertEqual(tree, otree)
コード例 #2
0
 def test_item_exists(self):
     otree = {'products': {
         'P1': {"F1": "V1"},
         'P2': {'versions': {'VER1': {'X1': 'X2',
                                      'items': {'ITEM1': {'IF1': 'IV2'}}}}}
     }}
     tree = deepcopy(otree)
     del otree['products']['P2']['versions']['VER1']['items']['ITEM1']
     util.products_del(tree, ('P2', 'VER1', 'ITEM1'))
     self.assertEqual(tree, otree)
コード例 #3
0
 def test_product_no_exists(self):
     ptree = {'P1': {'F1': 'V1'}}
     tree = {'products': deepcopy(ptree)}
     util.products_del(tree, ('P2',))
     self.assertEqual(tree, {'products': ptree})
コード例 #4
0
 def test_product_exists(self):
     tree = {'products': {'P1': {"F1": "V1"}}}
     util.products_del(tree, ('P1',))
     self.assertEqual(tree, {'products': {}})
コード例 #5
0
 def remove_item(self, data, src, target, pedigree):
     util.products_del(target, pedigree)
     if 'path' not in data:
         return
     if self._dec_rc(data['path'], src, pedigree):
         self.store.remove(data['path'])
コード例 #6
0
 def remove_item(self, data, src, target, pedigree):
     util.products_del(target, pedigree)
     if 'id' in data:
         print("removing %s: %s" % (data['id'], data['name']))
         self.gclient.images.delete(data['id'])