From bdc804694031de1c9c4d68829882976da22a376b Mon Sep 17 00:00:00 2001 From: Javid Gafar-zada Date: Thu, 14 Mar 2024 16:23:55 +0100 Subject: [PATCH] [AT-4406] Drop auth.env (#533) * Drop auth.env * Apply hooks * Version and CHANGELOG.md --- CHANGELOG.md | 7 +++++++ pyproject.toml | 2 +- tests/test_auth.py | 10 +--------- up42/auth.py | 16 +--------------- up42/project.py | 4 +--- up42/storage.py | 3 +-- 6 files changed, 12 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d539609a..acc85e641 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +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.0a13 + +**March 15, 2024** + +- Dropped unneeded `auth::env` property and the corresponding tests. + + ## 0.37.0a12 **March 14, 2024** diff --git a/pyproject.toml b/pyproject.toml index e85a20e52..f86c62b2e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "up42-py" -version = "0.37.0a12" +version = "0.37.0a13" description = "Python SDK for UP42, the geospatial marketplace and developer platform." authors = ["UP42 GmbH "] license = "https://github.com/up42/up42-py/blob/master/LICENSE" diff --git a/tests/test_auth.py b/tests/test_auth.py index a3039bf88..3b30f366b 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -6,7 +6,7 @@ import requests_mock as req_mock from up42 import auth as up42_auth -from up42 import host, utils +from up42 import utils from .fixtures import fixtures_globals as constants @@ -15,12 +15,9 @@ def test_auth_kwargs(): auth = up42_auth.Auth( project_id=constants.PROJECT_ID, project_api_key=constants.PROJECT_APIKEY, - env="abc", authenticate=False, retry=False, ) - assert auth.env == "abc" - assert host.DOMAIN == "abc" assert not auth.authenticate @@ -41,11 +38,6 @@ def test_should_not_authenticate_with_config_file_if_not_requested(): up42_auth.Auth(cfg_file=fp, authenticate=False) -def test_should_set_api_host_domain_with_environment(auth_mock: up42_auth.Auth): - auth_mock.env = "abc" - assert host.DOMAIN == "abc" - - def test_get_workspace(auth_mock: up42_auth.Auth): assert auth_mock.workspace_id == constants.WORKSPACE_ID diff --git a/up42/auth.py b/up42/auth.py index 050bcaf71..ee327a69d 100644 --- a/up42/auth.py +++ b/up42/auth.py @@ -67,13 +67,7 @@ def __init__( } credentials_dict = {key: value for key, value in credentials_dict.items() if value} - if "env" in kwargs: - self.env = kwargs["env"] - - try: - self.authenticate: bool = kwargs["authenticate"] - except KeyError: - self.authenticate = True + self.authenticate: bool = kwargs.get("authenticate", True) if project_id: self.project_id = project_id @@ -159,14 +153,6 @@ def _get_token_project_based(self): self.token = token_response["data"]["accessToken"] - @property - def env(self): - return host.DOMAIN - - @env.setter - def env(self, value: str): - host.DOMAIN = value - def _get_workspace(self) -> None: """Get user id belonging to authenticated account.""" url = host.endpoint("/users/me") diff --git a/up42/project.py b/up42/project.py index 3edc8f1d1..3ac690ab9 100644 --- a/up42/project.py +++ b/up42/project.py @@ -28,11 +28,9 @@ def __init__(self, auth: Auth, project_id: str): self._info = self.info def __repr__(self): - env = ", env: dev" if self.auth.env == "dev" else "" return ( f"Project(name: {self._info['name']}, project_id: {self.project_id}, " - f"description: {self._info['description']}, createdAt: {self._info['createdAt']}" - f"{env})" + f"description: {self._info['description']}, createdAt: {self._info['createdAt']})" ) @property diff --git a/up42/storage.py b/up42/storage.py index 1979b4881..3b74968b0 100644 --- a/up42/storage.py +++ b/up42/storage.py @@ -44,8 +44,7 @@ def __init__(self, auth: up42_auth.Auth): self.workspace_id = auth.workspace_id def __repr__(self): - env = ", env: dev" if self.auth.env == "dev" else "" - return f"Storage(workspace_id: {self.workspace_id}{env})" + return f"Storage(workspace_id: {self.workspace_id})" @property def pystac_client(self):