Esempio n. 1
0
 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)
Esempio n. 2
0
 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)
Esempio n. 3
0
    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')
Esempio n. 4
0
 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"})
Esempio n. 5
0
 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"})
Esempio n. 6
0
    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')
Esempio n. 7
0
 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')
Esempio n. 8
0
 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')