def test_cell_data_update_does_create_variables(self): dbapi.cells_create(self.context, cell1) res = dbapi.cells_get_by_name(self.context, cell1['region_id'], cell1['name']) self.assertEqual(res.variables, {}) variables = {"key1": "value1", "key2": "value2"} res = dbapi.cells_data_update(self.context, res.id, variables) self.assertEqual(res.variables, variables)
def test_cell_delete(self): dbapi.cells_create(self.context, cell1) # First make sure we have the cell res = dbapi.cells_get_by_name(self.context, cell1['region_id'], cell1['name']) self.assertEqual(res.name, 'cell1') dbapi.cells_delete(self.context, res.id) self.assertRaises(exceptions.NotFound, dbapi.cells_get_by_name, self.context, 'fake-region', 'fake-cell')
def test_cell_data_delete(self): dbapi.cells_create(self.context, cell1) res = dbapi.cells_get_by_name(self.context, cell1['region_id'], cell1['name']) self.assertEqual(res.variables, {}) variables = {"key1": "value1", "key2": "value2"} res = dbapi.cells_data_update(self.context, res.id, variables) self.assertEqual(res.variables, variables) # NOTE(sulo): we delete variables by their key res = dbapi.cells_data_delete(self.context, res.id, {"key1": "key1"}) self.assertEqual(res.variables, {"key2": "value2"})
def test_cell_get_by_name(self): dbapi.cells_create(self.context, cell1) res = dbapi.cells_get_by_name(self.context, cell1['region_id'], cell1['name']) self.assertEqual(res.name, 'cell1')