def insert(self, targeted_propagation, project_uuid): data = self._build_targeted_propagation_creation_data( targeted_propagation.get_propagation_params(), targeted_propagation.get_opm_params(), targeted_propagation.get_targeting_params(), project_uuid ) targeted_propagation.set_uuid(AdamObjects._insert(self, data))
def test_insert(self): rest = _RestProxyForTest() adam_objects = AdamObjects(rest, 'MyType') expected_data = {} def check_input(data_dict): self.assertEqual(expected_data, data_dict) return True expected_data = {'anyKey': 'anyVal'} rest.expect_post("/adam_object/single/MyType", check_input, 200, {'uuid': 'uuid1'}) uuid = adam_objects._insert({'anyKey': 'anyVal'}) self.assertEqual('uuid1', uuid) rest.expect_post("/adam_object/single/MyType", check_input, 404, {}) with self.assertRaises(RuntimeError): adam_objects._insert({'anyKey': 'anyVal'})
def insert(self, batch_propagation, project_uuid): data = self._build_batch_propagation_creation_data( batch_propagation.get_propagation_params(), batch_propagation.get_opm_params(), project_uuid) batch_propagation.set_uuid(AdamObjects._insert(self, data))