Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🤖 Update dependencies #35

Merged
merged 3 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
555 changes: 297 additions & 258 deletions pdm.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = 'sonyci'
description = 'A Sony Ci api client'
authors = [{ name = 'WGBH-MLA', email = 'ryan_harbert@wgbh.org' }]
dependencies = [
"pydantic~=2.1",
"pydantic~=2.3",
"requests-oauth2client~=1.1",
"loguru~=0.7",
]
Expand Down Expand Up @@ -36,7 +36,7 @@ tui = [
]
docs = [
"mkdocs~=1.5",
"mkdocs-material~=9.1",
"mkdocs-material~=9.2",
"mkdocs-git-revision-date-localized-plugin~=1.2",
"mike~=1.1",
"mkdocstrings[python]~=0.22",
Expand Down
5 changes: 2 additions & 3 deletions sonyci/sonyci.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any
from typing import Any, ClassVar

from requests_oauth2client import ApiClient, OAuth2Client
from requests_oauth2client.auth import BearerAuth, OAuth2AccessTokenAuth
Expand All @@ -10,8 +10,7 @@


class SonyCi(Config):
class Config:
arbitrary_types_allowed = True
model_config: ClassVar = {'arbitrary_types_allowed': True}

"""A SonyCI client."""
# This will not be needed when we upgrade to pydantic2,
Expand Down
2 changes: 1 addition & 1 deletion tests/cli/test_cli_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ def test_asset_search(runner, asset_id):
result = runner.invoke(app, ['asset', asset_id])
assert result.exit_code == 0
asset = loads(result.output)
assert type(asset) is dict
assert isinstance(asset, dict)
assert asset['id'] == asset_id
4 changes: 2 additions & 2 deletions tests/cli/test_cli_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_empty_search(runner, config):
)
assert result.exit_code == 0
output = loads(result.output)
assert type(output) is list
assert isinstance(output, list)
assert not output


Expand All @@ -35,7 +35,7 @@ def test_guid_search(runner, config, guid):
)
assert result.exit_code == 0
output = loads(result.output)
assert type(output) is list
assert isinstance(output, list)
assert len(output) == 1
assert guid in output[0]['name']
assert len(output) == 1
Expand Down
16 changes: 8 additions & 8 deletions tests/test_sonyci.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def ci_config(pytestconfig):

@fixture(scope='module')
def ci(ci_config: Config):
return SonyCi(**ci_config.dict())
return SonyCi(**ci_config.model_dump())


@mark.vcr()
Expand All @@ -25,35 +25,35 @@ def test_token(ci: SonyCi):
@mark.vcr()
def test_workspaces(ci: SonyCi):
workspaces = ci.workspaces()
assert type(workspaces) == list, 'workspaces is not a list'
assert isinstance(workspaces, list), 'workspaces is not a list'
assert len(workspaces) > 0, 'no workspaces found'


@mark.vcr()
def test_workspace(ci: SonyCi):
workspace = ci.workspace()
assert type(workspace) == dict, 'workspace is not a dict'
assert isinstance(workspace, dict), 'workspace is not a dict'
assert 'id' in workspace, 'workspace has no id'


@mark.vcr()
def test_workspace_contents(ci: SonyCi):
result = ci.workspace_contents()
assert type(result) is list
assert isinstance(result, list)
assert result


@mark.vcr()
def test_workspace_empty_search(ci: SonyCi):
result = ci.workspace_search(query='i am not a guid')
assert type(result) is list
assert isinstance(result, list)
assert not result


@mark.vcr()
def test_workspace_search(ci: SonyCi, guid: str):
assets = ci.workspace_search(guid)
assert type(assets) is list
assert isinstance(assets, list)
assert len(assets) == 1

assert guid in assets[0]['name']
Expand All @@ -62,12 +62,12 @@ def test_workspace_search(ci: SonyCi, guid: str):
@mark.vcr()
def test_asset(ci: SonyCi, asset_id, **kwargs):
asset = ci.asset(asset_id)
assert type(asset) is dict
assert isinstance(asset, dict)
assert asset['id'] == asset_id


@mark.vcr()
def test_asset_download(ci: SonyCi, asset_id, **kwargs):
asset = ci.asset_download(asset_id)
assert type(asset) is dict
assert isinstance(asset, dict)
assert asset['id'] == asset_id