def test_set_item(self):
     value = self.random()
     value2 = self.random()
     bag_name = self.random()
     bag = DataBag.create(bag_name)
     self.register(bag)
     item_name = self.random()
     item = DataBagItem.create(bag, item_name, foo=value)
     item['foo'] = value2
     item.save()
     self.assertEqual(item['foo'], value2)
     item2 = DataBagItem(bag, item_name)
     self.assertEqual(item2['foo'], value2)
Beispiel #2
0
 def test_set_item(self):
     value = self.random()
     value2 = self.random()
     bag_name = self.random()
     bag = DataBag.create(bag_name, self.api)
     self.register(bag)
     item_name = self.random()
     item = DataBagItem.create(bag, item_name, self.api, foo=value)
     item['foo'] = value2
     item.save()
     self.assertEqual(item['foo'], value2)
     item2 = DataBagItem(bag, item_name, self.api)
     self.assertEqual(item2['foo'], value2)
 def test_create_item(self):
     value = self.random()
     bag_name = self.random()
     bag = DataBag.create(bag_name)
     self.register(bag)
     item_name = self.random()
     item = DataBagItem.create(bag, item_name, foo=value)
     self.assertIn('foo', item)
     self.assertEqual(item['foo'], value)
     self.assertIn(item_name, bag)
     bag2 = DataBag(bag_name)
     self.assertIn(item_name, bag2)
     item2 = bag2[item_name]
     self.assertIn('foo', item)
     self.assertEqual(item['foo'], value)
Beispiel #4
0
 def test_create_item(self):
     value = self.random()
     bag_name = self.random()
     bag = DataBag.create(bag_name, self.api)
     self.register(bag)
     item_name = self.random()
     item = DataBagItem.create(bag, item_name, self.api, foo=value)
     self.assertIn('foo', item)
     self.assertEqual(item['foo'], value)
     self.assertIn(item_name, bag)
     bag2 = DataBag(bag_name, self.api)
     self.assertIn(item_name, bag2)
     item2 = bag2[item_name]
     self.assertIn('foo', item)
     self.assertEqual(item['foo'], value)
    def create_databag_item(self, bag_name, item_id, data={}):
        if not self.authenticated:
            return

        bag_name = self._bag_adapter.revert(bag_name)
        return DataBagItem.create(bag_name, item_id, api=self._api, **data)