diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index eee977d..b0af12f 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -20,9 +20,9 @@ jobs: runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 1a03a7b..4089a31 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -13,9 +13,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: '3.x' - name: Install dependencies diff --git a/requirements.txt b/requirements.txt index 047ed43..3e46cba 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -hsmodels == 0.5.4 +hsmodels >= 0.5.5 pytest == 6.0.2 requests == 2.24.0 email-validator diff --git a/setup.py b/setup.py index cf93f07..f2a2bf2 100644 --- a/setup.py +++ b/setup.py @@ -5,11 +5,11 @@ setup( name='hsclient', - version='0.3.2', + version='0.3.3', packages=find_packages(include=['hsclient', 'hsclient.*'], exclude=("tests",)), install_requires=[ - 'hsmodels==0.5.4', + 'hsmodels>=0.5.5', 'requests', 'requests_oauthlib', 'pandas' diff --git a/tests/test_functional.py b/tests/test_functional.py index 69ba820..3eda315 100644 --- a/tests/test_functional.py +++ b/tests/test_functional.py @@ -185,7 +185,7 @@ def test_resource_metadata_updating(new_resource): new_resource.metadata.title = "resource test" new_resource.metadata.additional_metadata = {"key1": "value1", "key2": "value2", "key3": "value3"} new_resource.metadata.abstract = "world’s" - new_resource.metadata.relations = [Relation(type=RelationType.isCopiedFrom, value="is hosted by value")] + new_resource.metadata.relations = [Relation(type=RelationType.isVersionOf, value="is version of")] new_resource.save() @@ -198,7 +198,7 @@ def test_resource_metadata_updating(new_resource): assert new_resource.metadata.additional_metadata["key3"] == "value3" assert new_resource.metadata.abstract == "world’s" - assert new_resource.metadata.relations == [Relation(type=RelationType.isCopiedFrom, value="is hosted by value")] + assert new_resource.metadata.relations == [Relation(type=RelationType.isVersionOf, value="is version of")] def test_system_metadata(new_resource): @@ -218,7 +218,7 @@ def test_resource_delete(hydroshare, new_resource): def test_resource_cached_by_HydroShare_instance_slow(hydroshare, new_resource): - """ Verify resource object is present in resource object cache. """ + """Verify resource object is present in resource object cache.""" res_id = new_resource.resource_id res = hydroshare.resource(res_id) @@ -416,21 +416,25 @@ def test_empty_creator(new_resource): def test_aggregations(new_resource, files): root_path = "data/test_resource_metadata_files/" file_count = len(files) - 2 # exclude rdf/xml file + aggr_file_count = file_count new_resource.file_upload(*[os.path.join(root_path, file) for file in files]) assert len(new_resource.aggregations()) == 1 assert len(new_resource.files()) == 0 agg = new_resource.aggregations()[0] agg_type = agg.metadata.type - assert len(agg.files()) == file_count + assert len(agg.files()) == aggr_file_count new_resource.aggregation_remove(agg) assert len(new_resource.aggregations()) == 0 + if agg_type == "NetCDF": + # the txt file of the aggregation gets deleted when the netcdf aggregation is removed. + file_count = file_count - 1 assert len(new_resource.files()) == file_count main_file = next(f for f in new_resource.files() if f.path.endswith(files[0])) assert main_file agg = new_resource.file_aggregate(main_file, agg_type) assert len(new_resource.aggregations()) == 1 assert len(new_resource.files()) == 0 - assert len(agg.files()) == file_count + assert len(agg.files()) == aggr_file_count with tempfile.TemporaryDirectory() as tmp: new_resource.aggregation_download(agg, tmp) files = os.listdir(tmp) @@ -587,5 +591,6 @@ def test_resource_public(resource): resource.set_sharing_status(public=False) assert resource.system_metadata()['public'] is False + def test_instantiate_hydroshare_object_without_args(): HydroShare()