def test_region_data_update_does_create_variables(self): dbapi.regions_create(self.context, region1) res = dbapi.regions_get_by_name(self.context, region1['name']) self.assertEqual(res.variables, {}) variables = {"key1": "value1", "key2": "value2"} res = dbapi.regions_data_update(self.context, res.id, variables) self.assertEqual(res.variables, variables)
def test_region_delete(self): dbapi.regions_create(self.context, region1) # First make sure we have the region res = dbapi.regions_get_by_name(self.context, region1['name']) self.assertEqual(res.name, 'region1') dbapi.regions_delete(self.context, res.id) self.assertRaises(exceptions.NotFound, dbapi.regions_get_by_name, self.context, 'fake-region')
def test_region_data_delete(self): dbapi.regions_create(self.context, region1) res = dbapi.regions_get_by_name(self.context, region1['name']) self.assertEqual(res.variables, {}) variables = {"key1": "value1", "key2": "value2"} res = dbapi.regions_data_update(self.context, res.id, variables) self.assertEqual(res.variables, variables) # NOTE(sulo): we delete variables by their key res = dbapi.regions_data_delete(self.context, res.id, {"key1": "key1"}) self.assertEqual(res.variables, {"key2": "value2"})
def test_region_get_by_name(self): dbapi.regions_create(self.context, region1) res = dbapi.regions_get_by_name(self.context, region1['name']) self.assertEqual(res.name, 'region1')