diff --git a/.github/workflows/buildandtestpyaqsapi.yml b/.github/workflows/buildandtestpyaqsapi.yml index f32586d..0093062 100644 --- a/.github/workflows/buildandtestpyaqsapi.yml +++ b/.github/workflows/buildandtestpyaqsapi.yml @@ -13,7 +13,7 @@ on: defaults: run: - shell: bash -leo pipefail {0} + shell: bash -el {0} jobs: setup_environment: @@ -29,11 +29,6 @@ jobs: steps: - name: checkout uses: actions/checkout@v3 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - name: setup environment uses: mamba-org/setup-micromamba@v2 @@ -41,11 +36,10 @@ jobs: environment-file: environment.yml init-shell: >- bash - powershell cache-environment: true environment-name: pyaqsapi post-cleanup: 'all' - shell: pwsh + shell: bash - name: Display Python and sphinx version and system info run: | diff --git a/pyaqsapi/helperfunctions.py b/pyaqsapi/helperfunctions.py index 760cfac..d68002b 100644 --- a/pyaqsapi/helperfunctions.py +++ b/pyaqsapi/helperfunctions.py @@ -1113,7 +1113,7 @@ def aqs_removeheader( """ aqsresult = DataFrame() - for x in enumerate(aqsobject): + for x in range(len(aqsobject)): aqsresult = concat([aqsresult, aqsobject[x].get_data()], axis=0) return aqsresult diff --git a/pyaqsapi/metadatafunctions.py b/pyaqsapi/metadatafunctions.py index 081d261..e2bfa4f 100644 --- a/pyaqsapi/metadatafunctions.py +++ b/pyaqsapi/metadatafunctions.py @@ -81,10 +81,9 @@ def aqs_revisionhistory( (pandas DataFrame or an AQSAPI_V2 object): Information on the revision history to the AQS Datamart API. """ - service = "metaData" aqsfilter = "revisionHistory" aqsresult = helperfunctions.AQSAPI_V2() - aqsresult._aqs_metadata_services(service=service, aqsfilter=aqsfilter) + aqsresult._aqs_metadata_services(aqsfilter=aqsfilter) if return_header: return aqsresult else: diff --git a/tests/test_metadatafunctions.py b/tests/test_metadatafunctions.py new file mode 100644 index 0000000..b001db1 --- /dev/null +++ b/tests/test_metadatafunctions.py @@ -0,0 +1,38 @@ +from os import environ, getcwd +from os.path import abspath, exists +from sys import path + +import pytest + +import pyaqsapi.metadatafunctions as metadatafunctions +from pyaqsapi.helperfunctions import aqs_credentials + +@pytest.fixture +def setuppyaqsapi(autouse=True): + # print(f"the current working directory is: {getcwd()}") + if exists("./dev/local.py"): + # the following should only execute if the file ./dev/local.py exists + # under the project root folder. This file should not exist on the git + # repostiory or in the final package. local looads the AQS user + # credentials for testing + path.append(abspath("./dev")) + import local + + AQSuser, AQSkey = local.setuppyaqsapitest() + aqs_credentials(username=AQSuser, key=AQSkey) + else: + # get the credential information from environment variables if using + # github actions + AQSuser = environ.get("AQSuser") + assert AQSuser is not None + AQSkey = environ.get("AQSkey") + assert AQSkey is not None + aqs_credentials(username=AQSuser, key=AQSkey) + + +def test_aqs_knownissues(setuppyaqsapi): + assert metadatafunctions.aqs_knownissues(return_header=True).get_status_code() == "200" + + +def test_aqs_revisionhistory(setuppyaqsapi): + assert metadatafunctions.aqs_revisionhistory(return_header=True).get_status_code() == "200" \ No newline at end of file