def test_operation_create_from_node_properties(self): """Test the create function with node properties""" _ctx = self.get_mock_ctx() current_ctx.set(_ctx) _ctx.node.properties['resource_config'] = self._resource_config self.addCleanup(os.remove, self._file_path) operation_output = operation_task.create() self.common_asserts(operation_output)
def test_operation_create_from_inputs(self): """Test the create function with inputs""" _ctx = self.get_mock_ctx() current_ctx.set(_ctx) resource_config = self._resource_config self.addCleanup(os.remove, self._file_path) operation_output = \ operation_task.create(resource_config=resource_config) self.common_asserts(operation_output)
def test_operation_create_from_runtime_properties_sudo(self): """Test the create function with runtime properties""" _ctx = self.get_mock_ctx() current_ctx.set(_ctx) self._resource_config['use_sudo'] = True _ctx.instance.runtime_properties['resource_config'] = \ self._resource_config self.addCleanup(os.remove, self._file_path) operation_output = operation_task.create() self.common_asserts(operation_output)
def test_operation_delete(self): """Test the create function with runtime properties""" _ctx = self.get_mock_ctx() current_ctx.set(_ctx) resource_config = self._resource_config # self.addCleanup(os.remove, self._file_path) operation_output = \ operation_task.create(resource_config=resource_config) self.common_asserts(operation_output) operation_task.delete(resource_config=resource_config) self.assertIs(False, os.path.exists(resource_config.get('file_path')))