def test_required_workspace_missing(self): """Tests calling JobInterface.validate_connection() when a required workspace is missing""" job_interface_dict = { 'command': 'simple-command', 'command_arguments': '', 'version': '1.1', 'input_data': [{ 'name': 'Input 1', 'type': 'property', }, { 'name': 'Input 2', 'type': 'file', 'media_types': ['text/plain'], 'partial': True }], 'output_data': [{ 'name': 'Output 1', 'type': 'file', }] } job_interface = JobInterface(job_interface_dict) job_conn = JobConnection() job_conn.add_property('Input 1') job_conn.add_input_file('Input 2', False, ['text/plain'], False, True) self.assertRaises(InvalidConnection, job_interface.validate_connection, job_conn)
def test_no_workspace_needed(self): """Tests calling JobInterface.validate_connection() without a workspace, but none is needed.""" job_interface_dict = { 'command': 'simple-command', 'command_arguments': '', 'version': '1.1', 'input_data': [{ 'name': 'Input 1', 'type': 'property', }, { 'name': 'Input 2', 'type': 'file', 'media_types': ['text/plain'], 'partial': True }], 'output_data': [], } job_interface = JobInterface(job_interface_dict) job_conn = JobConnection() job_conn.add_property('Input 1') job_conn.add_input_file('Input 2', False, ['text/plain'], False, True) # No exception is success job_interface.validate_connection(job_conn)
def test_no_workspace_needed(self): '''Tests calling JobInterface.validate_connection() without a workspace, but none is needed.''' job_interface_dict = { 'command': 'simple-command', 'command_arguments': '', 'version': '1.0', 'input_data': [{ 'name': 'Input 1', 'type': 'property', }, { 'name': 'Input 2', 'type': 'file', 'media_types': ['text/plain'], }], 'output_data': [], } job_interface = JobInterface(job_interface_dict) job_conn = JobConnection() job_conn.add_property('Input 1') job_conn.add_input_file('Input 2', False, ['text/plain'], False) # No exception is success job_interface.validate_connection(job_conn)
def test_successful(self): """Tests calling JobInterface.validate_connection() successfully.""" job_interface_dict = { 'command': 'simple-command', 'command_arguments': '', 'version': '1.0', 'input_data': [{ 'name': 'Input 1', 'type': 'property', }, { 'name': 'Input 2', 'type': 'file', 'media_types': ['text/plain'] }], 'output_data': [{ 'name': 'Output 1', 'type': 'file', }] } job_interface = JobInterface(job_interface_dict) job_conn = JobConnection() job_conn.add_property('Input 1') job_conn.add_input_file('Input 2', False, ['text/plain'], False, False) job_conn.add_workspace() # No exception is success job_interface.validate_connection(job_conn)
def test_required_workspace_missing(self): '''Tests calling JobInterface.validate_connection() when a required workspace is missing''' job_interface_dict = { 'command': 'simple-command', 'command_arguments': '', 'version': '1.0', 'input_data': [{ 'name': 'Input 1', 'type': 'property', }, { 'name': 'Input 2', 'type': 'file', 'media_types': ['text/plain'], }], 'output_data': [{ 'name': 'Output 1', 'type': 'file', }] } job_interface = JobInterface(job_interface_dict) job_conn = JobConnection() job_conn.add_property('Input 1') job_conn.add_input_file('Input 2', False, ['text/plain'], False) self.assertRaises(InvalidConnection, job_interface.validate_connection, job_conn)
def test_required_missing(self): '''Tests calling JobConnection.validate_properties() when a required property is missing''' property_names = {u'Param1': True, u'Param2': True, u'Param3': False} conn = JobConnection() conn.add_property(u'Param1') self.assertRaises(InvalidConnection, conn.validate_properties, property_names)
def test_required_missing(self): """Tests calling JobConnection.validate_properties() when a required property is missing""" property_names = {'Param1': True, 'Param2': True, 'Param3': False} conn = JobConnection() conn.add_property('Param1') self.assertRaises(InvalidConnection, conn.validate_properties, property_names)
def test_successful(self): '''Tests calling JobConnection.validate_properties() successfully''' property_names = {u'Param1': True, u'Param2': False, u'Param3': False} conn = JobConnection() conn.add_property(u'Param1') conn.add_property(u'Param2') # No exception is success warnings = conn.validate_properties(property_names) self.assertFalse(warnings)
def test_successful(self): '''Tests calling JobInterface.validate_connection() successfully.''' job_interface_dict = { u'command': u'simple-command', u'command_arguments': u'', u'version': u'1.0', u'input_data': [{u'name': u'Input 1', u'type': u'property'}, {u'name': u'Input 2', u'type': u'file', u'media_types': [u'text/plain']}], u'output_data': [{u'name': u'Output 1', u'type': u'file'}] } job_interface = JobInterface(job_interface_dict) job_conn = JobConnection() job_conn.add_property(u'Input 1') job_conn.add_input_file(u'Input 2', False, [u'text/plain'], False) job_conn.add_workspace() # No exception is success job_interface.validate_connection(job_conn)