def test_cell_data_update_does_update_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) new_variables = {"key1": "tom", "key2": "cat"} res = dbapi.cells_data_update(self.context, res.id, new_variables) self.assertEqual(res.variables, new_variables)
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"})