Exemplo n.º 1
0
    def test_get_workflow_versions(self, mock_trs_client):
        mock_workflow_versions = [{'url': '', 'id': ''}, {'url': '', 'id': ''}]

        mock_response = BravadoResponseMock(result=mock_workflow_versions)
        operator = mock_trs_client.toolsIdVersionsGet
        operator.return_value.response = mock_response

        trs_instance = TRS(trs_id='mock_trs', api_client=mock_trs_client)
        test_workflow_versions = trs_instance.get_workflow_versions(
            id='mock_wf')

        assert isinstance(test_workflow_versions, list)
        assert test_workflow_versions == mock_workflow_versions
Exemplo n.º 2
0
    def test_get_workflow_files(self, mock_trs_client):
        mock_workflow_files = [{'path': '', 'file_type': ''}]

        mock_response = BravadoResponseMock(result=mock_workflow_files)
        operator = mock_trs_client.toolsIdVersionsVersionIdTypeFilesGet
        operator.return_value.response = mock_response

        trs_instance = TRS(trs_id='mock_trs', api_client=mock_trs_client)
        test_workflow_files = trs_instance.get_workflow_files(
            id='mock_wf', version_id='test', type='CWL')

        assert isinstance(test_workflow_files, list)
        assert test_workflow_files == mock_workflow_files
Exemplo n.º 3
0
    def test_get_workflow_descriptor_relative(self, mock_trs_client):
        mock_workflow_descriptor = {'content': '', 'url': ''}

        mock_response = BravadoResponseMock(result=mock_workflow_descriptor)
        operator = mock_trs_client.toolsIdVersionsVersionIdTypeDescriptorRelativePathGet
        operator.return_value.response = mock_response

        trs_instance = TRS(trs_id='mock_trs', api_client=mock_trs_client)
        test_workflow_descriptor = trs_instance.get_workflow_descriptor_relative(
            id='mock_wf', version_id='test', type='CWL', relative_path='')

        assert isinstance(test_workflow_descriptor, dict)
        assert test_workflow_descriptor == mock_workflow_descriptor
Exemplo n.º 4
0
    def test_get_metadata(self, mock_trs_client):
        mock_metadata = {
            'version': '1.0.0',
            'api_version': '1.0.0',
            'country': '',
            'friendly_name': 'mock_trs'
        }

        mock_response = BravadoResponseMock(result=mock_metadata)
        mock_trs_client.metadataGet.return_value.response = mock_response

        trs_instance = TRS(trs_id='mock_trs', api_client=mock_trs_client)
        test_metadata = trs_instance.get_metadata()

        assert isinstance(test_metadata, dict)
        assert test_metadata == mock_metadata
Exemplo n.º 5
0
    def test_get_workflow(self, mock_trs_client):
        mock_workflow = {
            'url': '',
            'id': 'mock_wf',
            'organization': '',
            'author': '',
            'toolclass': {},
            'versions': []
        }

        mock_response = BravadoResponseMock(result=mock_workflow)
        mock_trs_client.toolsIdGet.return_value.response = mock_response

        trs_instance = TRS(trs_id='mock_trs', api_client=mock_trs_client)
        test_workflow = trs_instance.get_workflow('mock_wf')

        assert isinstance(test_workflow, dict)
        assert test_workflow == mock_workflow
Exemplo n.º 6
0
    def test_init(self, mock_trs_client):
        trs_instance = TRS(trs_id='mock_trs', api_client=mock_trs_client)

        assert hasattr(trs_instance, 'api_client')
        assert hasattr(trs_instance.api_client, 'metadataGet')