Skip to content
This repository was archived by the owner on May 22, 2024. It is now read-only.
This repository was archived by the owner on May 22, 2024. It is now read-only.

Fix failing test in master branch #24

@lewismc

Description

@lewismc

From travis-ci build

================================================================================================= FAILURES =================================================================================================
_____________________________________________________________________________________ TestCMRIntegration.test_monolith _____________________________________________________________________________________

self = <pyCMR.tests.test_cmr_integration.TestCMRIntegration testMethod=test_monolith>

    def test_monolith(self):
         '''
             Since these are order-sensitive integration tests,
             wrap them in a monolithic test, so that they run in the proper order
             and stop after a single failure (without having to specify `failfast`)

             https://stackoverflow.com/questions/5387299/python-unittest-testcase-execution-order
             '''

         for test_name in [
             'collection_search',
             'granule_search',
             'collection_ingest',
             'granule_ingest',
             'collection_update',
             'granule_update',
             'granule_delete',
             'collection_delete'
         ]:
             test = getattr(self, test_name)
>            test()

pyCMR/tests/test_cmr_integration.py:95:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pyCMR/tests/test_cmr_integration.py:42: in collection_ingest
    result = self.cmr.ingestCollection(self._test_collection_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pyCMR.pyCMR.CMR object at 0x1095457b8>, XMLData = '/usr/local/cmr/pyCMR/tests/fixtures/test-collection.xml'

    def ingestCollection(self, XMLData):
        """
            :purpose : ingest the collections using cmr rest api
            :param XMLData: a parameter that holds the XML data that needs to be ingested it can be a file
            :return: the ingest collection request if it is successfully validated
            """

        if not XMLData:
            return False

        if os.path.isfile(XMLData):
            data = self._getXMLData(pathToXMLFile=XMLData)
        else:
            data=XMLData


        dataset_id = self._getDataSetId(pathToXMLFile=data)
        url = self._INGEST_URL + self._PROVIDER + "/collections/" + dataset_id
        validationRequest = self._validateCollection(data=data, dataset_id=dataset_id)
        if validationRequest.ok:  # if the collection is valid
            if self.isTokenExpired():  # check if the token has been expired
                self._generateNewToken()
            putCollection = self.session.put(url=url, data=data, headers=self._INGEST_HEADER)  # ingest granules

            return putCollection.content

        else:
>           raise ValueError("Collection failed to validate:\n{}".format(validationRequest.content))
E           ValueError: Collection failed to validate:
E           b'<?xml version="1.0" encoding="UTF-8"?><errors><error>Provider with provider-id [*****] does not exist.</error></errors>'

pyCMR/pyCMR.py:223: ValueError
=================================================================================== 1 failed, 1 passed in 17.67 seconds ====================================================================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions