Skip to content

Commit

Permalink
[AT-3970] enable pylint for storage, host, and tools (#562)
Browse files Browse the repository at this point in the history
* fix tools

* storage: initial commit

* drop live tests

* drop function that's not used anymore

* remove live tests fixture
  • Loading branch information
seedlit authored Mar 13, 2024
1 parent b2d84d2 commit a9ba8ca
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 295 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ You can check your current version with the following command:

For more information, see [UP42 Python package description](https://pypi.org/project/up42-py/).

## 0.37.0a5
## 0.37.0a6

**March 13, 2024**

- Adjusted `host.py`, `tools.py`, `test_tools.py`, `storage.py`, `test_storage.py`, and `fixtures_storage.py` in accordance with Pylint checks.

## 0.37.0a5

**March 11, 2024**

Expand All @@ -41,7 +46,6 @@ For more information, see [UP42 Python package description](https://pypi.org/pro

## 0.37.0a4


**March 07, 2024**

- Generalized new authentication stack to cover account authentication case.
Expand Down
2 changes: 1 addition & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ignore=

# Files or directories matching the regex patterns are skipped. The regex
# matches against base names, not paths.
ignore-patterns=.*init.*,.*asset.*.py,.*initialization.py,.*job.*.py,.*estimation.py,.*http_adapter.py,.*host.py,.*main.py,macros.py,.*order.py,.*project.py,.*stac_client.py,.*storage.py,.*tools.py,.*utils.py,.*vis.*.py,.*viz.*.py,.*webhook.*.py,.*workflow.py,.*e2e.*.py
ignore-patterns=.*init.*,.*asset.*.py,.*initialization.py,.*job.*.py,.*estimation.py,.*http_adapter.py,.*main.py,macros.py,.*order.py,.*project.py,.*stac_client.py,.*utils.py,.*vis.*.py,.*viz.*.py,.*webhook.*.py,.*workflow.py,.*e2e.*.py


# Pickle collected data for later comparisons.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "up42-py"
version = "0.37.0a5"
version = "0.37.0a6"
description = "Python SDK for UP42, the geospatial marketplace and developer platform."
authors = ["UP42 GmbH <[email protected]>"]
license = "https://github.com/up42/up42-py/blob/master/LICENSE"
Expand Down
53 changes: 17 additions & 36 deletions tests/fixtures/fixtures_storage.py
Original file line number Diff line number Diff line change
@@ -1,63 +1,44 @@
import pytest

from up42.storage import Storage
from up42 import storage

from .fixtures_globals import (
API_HOST,
ASSET_ID,
JSON_ASSET,
JSON_ASSETS,
JSON_ORDER,
JSON_ORDERS,
JSON_STORAGE_STAC,
ORDER_ID,
PYSTAC_MOCK_CLIENT,
)
from . import fixtures_globals as constants


@pytest.fixture()
def storage_mock(auth_mock, requests_mock):
# pystac client authentication
url_pystac_client = f"{API_HOST}/v2/assets/stac"
requests_mock.get(url=url_pystac_client, json=PYSTAC_MOCK_CLIENT)
url_pystac_client = f"{constants.API_HOST}/v2/assets/stac"
requests_mock.get(url=url_pystac_client, json=constants.PYSTAC_MOCK_CLIENT)

# assets
url_storage_assets = f"{API_HOST}/v2/assets"
requests_mock.get(url=url_storage_assets, json=JSON_ASSETS)
url_storage_assets = f"{constants.API_HOST}/v2/assets"
requests_mock.get(url=url_storage_assets, json=constants.JSON_ASSETS)

# storage stac
url_storage_stac = f"{API_HOST}/v2/assets/stac/search"
requests_mock.post(url=url_storage_stac, json=JSON_STORAGE_STAC)
url_storage_stac = f"{constants.API_HOST}/v2/assets/stac/search"
requests_mock.post(url=url_storage_stac, json=constants.JSON_STORAGE_STAC)

# asset info
url_asset_info = f"{API_HOST}/v2/assets/{ASSET_ID}/metadata"
requests_mock.get(url=url_asset_info, json=JSON_ASSET)
url_asset_info = f"{constants.API_HOST}/v2/assets/{constants.ASSET_ID}/metadata"
requests_mock.get(url=url_asset_info, json=constants.JSON_ASSET)

# orders
url_storage_orders = (
f"{API_HOST}/v2/orders"
f"{constants.API_HOST}/v2/orders"
"?sort=createdAt,desc&workspaceId=workspace_id_123"
"&type=ARCHIVE&tags=project-7&tags=optical&size=50"
)
requests_mock.get(url=url_storage_orders, json=JSON_ORDERS)
requests_mock.get(url=url_storage_orders, json=constants.JSON_ORDERS)

url_storage_orders_params = (
f"{API_HOST}/v2/orders"
f"{constants.API_HOST}/v2/orders"
"?sort=createdAt,desc"
"&displayName=Test&type=ARCHIVE&status=FULFILLED&status=PLACED&size=50"
)
requests_mock.get(url=url_storage_orders_params, json=JSON_ORDERS)
requests_mock.get(url=url_storage_orders_params, json=constants.JSON_ORDERS)

# orders info
url_order_info = f"{API_HOST}/v2/orders/{ORDER_ID}"
requests_mock.get(url=url_order_info, json=JSON_ORDER)

storage = Storage(auth=auth_mock)

return storage


@pytest.fixture()
def storage_live(auth_live):
storage = Storage(auth=auth_live)
return storage
url_order_info = f"{constants.API_HOST}/v2/orders/{constants.ORDER_ID}"
requests_mock.get(url=url_order_info, json=constants.JSON_ORDER)
return storage.Storage(auth=auth_mock)
Loading

0 comments on commit a9ba8ca

Please sign in to comment.