Skip to content

Commit

Permalink
Merge pull request #49 from hydroshare/hsmodels_update_0.5.5
Browse files Browse the repository at this point in the history
use hsmodels 0.5.5
  • Loading branch information
devincowan authored Apr 19, 2023
2 parents dfc9e4c + e332aa2 commit 4ba327b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hsmodels == 0.5.4
hsmodels >= 0.5.5
pytest == 6.0.2
requests == 2.24.0
email-validator
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
15 changes: 10 additions & 5 deletions tests/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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):
Expand All @@ -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)

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()

0 comments on commit 4ba327b

Please sign in to comment.