From 519f2f39e9ea61c41e443378a30422e474e02bf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Murawski?= Date: Fri, 26 Jul 2024 20:21:46 +0200 Subject: [PATCH] fix: Removed unused tenant in auth interface --- README.md | 2 +- gen/tests_generator.py | 4 ++-- osdu_client/auth.py | 13 ++----------- pyproject.toml | 2 +- tests/conftest.py | 0 tests/dataset/conftest.py | 1 - tests/entitlements/conftest.py | 1 - tests/file/conftest.py | 1 - tests/indexer/conftest.py | 3 +-- tests/legal/conftest.py | 3 +-- tests/notification/conftest.py | 1 - tests/partition/conftest.py | 3 +-- tests/policy/conftest.py | 3 +-- tests/pws/conftest.py | 1 - tests/rafs/conftest.py | 3 +-- tests/register/conftest.py | 3 +-- tests/schema/conftest.py | 3 +-- tests/sdms/conftest.py | 3 +-- tests/search/conftest.py | 3 +-- tests/secret/conftest.py | 3 +-- tests/storage/conftest.py | 1 - tests/wellbore/conftest.py | 1 - tests/welldelivery/conftest.py | 1 - 23 files changed, 16 insertions(+), 43 deletions(-) delete mode 100644 tests/conftest.py diff --git a/README.md b/README.md index 50cd14d..d4a0ea3 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ from osdu_client.auth import AuthBackendInterface class AuthSession(AuthBackendInterface): base_url = "https://base.url" default_data_partition_id = "osdu" - default_tenant = "osdu" + authorization_header = {"Authorization": "Bearer access_token"} def get_sd_connection_params(self): diff --git a/gen/tests_generator.py b/gen/tests_generator.py index e0e95ac..e43422a 100644 --- a/gen/tests_generator.py +++ b/gen/tests_generator.py @@ -32,7 +32,7 @@ def create_conftest(module_path: str, name: str): module = import_module(f"osdu_client.services.{name.lower()}") versions = getattr(module, "VERSIONS", {}) - + import_lines = [ "import pytest", "import os", @@ -51,7 +51,7 @@ def create_conftest(module_path: str, name: str): f"{INDENT}class AuthSession(AuthBackendInterface):", f'{INDENT*2}base_url = "https://base.url"', f'{INDENT*2}default_data_partition_id = "osdu"', - f'{INDENT*2}default_tenant = "osdu"', + f'{INDENT*2}', '%sauthorization_header = {"Authorization": "Bearer access_token"}' % (INDENT*2), "\n", f"{INDENT*2}def get_sd_connection_params(self):", diff --git a/osdu_client/auth.py b/osdu_client/auth.py index b96606b..7eb4298 100644 --- a/osdu_client/auth.py +++ b/osdu_client/auth.py @@ -8,19 +8,10 @@ class AuthBackendInterface(metaclass=ABCMeta): def get_headers(self) -> dict: headers = {} headers.update(self.authorization_header) - headers.update( - { - "tenant": self.default_tenant, - "data-partition-id": self.default_data_partition_id - } - ) + headers["data-partition-id"] = self.default_data_partition_id + return headers - @property - @abstractmethod - def default_tenant(self) -> str: - pass - @property @abstractmethod def default_data_partition_id(self) -> str: diff --git a/pyproject.toml b/pyproject.toml index 182818d..4a06778 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "osdu-client" -version = "1.2.0" +version = "1.3.0" description = "OSDU API Client" authors = ["Michal Murawski "] readme = "README.md" diff --git a/tests/conftest.py b/tests/conftest.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/dataset/conftest.py b/tests/dataset/conftest.py index 7efd4d8..1858b28 100644 --- a/tests/dataset/conftest.py +++ b/tests/dataset/conftest.py @@ -15,7 +15,6 @@ def auth_backend() -> AuthBackendInterface: class AuthSession(AuthBackendInterface): base_url = "https://base.url" default_data_partition_id = "osdu" - default_tenant = "osdu" authorization_header = {"Authorization": "Bearer access_token"} diff --git a/tests/entitlements/conftest.py b/tests/entitlements/conftest.py index e42b37b..76a55f7 100644 --- a/tests/entitlements/conftest.py +++ b/tests/entitlements/conftest.py @@ -15,7 +15,6 @@ def auth_backend() -> AuthBackendInterface: class AuthSession(AuthBackendInterface): base_url = "https://base.url" default_data_partition_id = "osdu" - default_tenant = "osdu" authorization_header = {"Authorization": "Bearer access_token"} diff --git a/tests/file/conftest.py b/tests/file/conftest.py index ea0fdd1..1f70551 100644 --- a/tests/file/conftest.py +++ b/tests/file/conftest.py @@ -15,7 +15,6 @@ def auth_backend() -> AuthBackendInterface: class AuthSession(AuthBackendInterface): base_url = "https://base.url" default_data_partition_id = "osdu" - default_tenant = "osdu" authorization_header = {"Authorization": "Bearer access_token"} diff --git a/tests/indexer/conftest.py b/tests/indexer/conftest.py index e5f3f51..b95d8b3 100644 --- a/tests/indexer/conftest.py +++ b/tests/indexer/conftest.py @@ -14,8 +14,7 @@ def auth_backend() -> AuthBackendInterface: class AuthSession(AuthBackendInterface): base_url = "https://base.url" - default_data_partition_id = "osdu" - default_tenant = "osdu" + default_data_partition_id = "osdu" authorization_header = {"Authorization": "Bearer access_token"} diff --git a/tests/legal/conftest.py b/tests/legal/conftest.py index 708a256..29fd740 100644 --- a/tests/legal/conftest.py +++ b/tests/legal/conftest.py @@ -14,8 +14,7 @@ def auth_backend() -> AuthBackendInterface: class AuthSession(AuthBackendInterface): base_url = "https://base.url" - default_data_partition_id = "osdu" - default_tenant = "osdu" + default_data_partition_id = "osdu" authorization_header = {"Authorization": "Bearer access_token"} diff --git a/tests/notification/conftest.py b/tests/notification/conftest.py index b6ac4a4..f3e41c8 100644 --- a/tests/notification/conftest.py +++ b/tests/notification/conftest.py @@ -15,7 +15,6 @@ def auth_backend() -> AuthBackendInterface: class AuthSession(AuthBackendInterface): base_url = "https://base.url" default_data_partition_id = "osdu" - default_tenant = "osdu" authorization_header = {"Authorization": "Bearer access_token"} diff --git a/tests/partition/conftest.py b/tests/partition/conftest.py index 16bbb93..515f833 100644 --- a/tests/partition/conftest.py +++ b/tests/partition/conftest.py @@ -14,8 +14,7 @@ def auth_backend() -> AuthBackendInterface: class AuthSession(AuthBackendInterface): base_url = "https://base.url" - default_data_partition_id = "osdu" - default_tenant = "osdu" + default_data_partition_id = "osdu" authorization_header = {"Authorization": "Bearer access_token"} diff --git a/tests/policy/conftest.py b/tests/policy/conftest.py index ced1375..bf29240 100644 --- a/tests/policy/conftest.py +++ b/tests/policy/conftest.py @@ -14,8 +14,7 @@ def auth_backend() -> AuthBackendInterface: class AuthSession(AuthBackendInterface): base_url = "https://base.url" - default_data_partition_id = "osdu" - default_tenant = "osdu" + default_data_partition_id = "osdu" authorization_header = {"Authorization": "Bearer access_token"} diff --git a/tests/pws/conftest.py b/tests/pws/conftest.py index 5dd6710..d64aaec 100644 --- a/tests/pws/conftest.py +++ b/tests/pws/conftest.py @@ -15,7 +15,6 @@ def auth_backend() -> AuthBackendInterface: class AuthSession(AuthBackendInterface): base_url = "https://base.url" default_data_partition_id = "osdu" - default_tenant = "osdu" authorization_header = {"Authorization": "Bearer access_token"} diff --git a/tests/rafs/conftest.py b/tests/rafs/conftest.py index f91eadd..cc0978e 100644 --- a/tests/rafs/conftest.py +++ b/tests/rafs/conftest.py @@ -14,8 +14,7 @@ def auth_backend() -> AuthBackendInterface: class AuthSession(AuthBackendInterface): base_url = "https://base.url" - default_data_partition_id = "osdu" - default_tenant = "osdu" + default_data_partition_id = "osdu" authorization_header = {"Authorization": "Bearer access_token"} diff --git a/tests/register/conftest.py b/tests/register/conftest.py index 4a06c87..e13eb15 100644 --- a/tests/register/conftest.py +++ b/tests/register/conftest.py @@ -14,8 +14,7 @@ def auth_backend() -> AuthBackendInterface: class AuthSession(AuthBackendInterface): base_url = "https://base.url" - default_data_partition_id = "osdu" - default_tenant = "osdu" + default_data_partition_id = "osdu" authorization_header = {"Authorization": "Bearer access_token"} diff --git a/tests/schema/conftest.py b/tests/schema/conftest.py index 64a2faf..289e91b 100644 --- a/tests/schema/conftest.py +++ b/tests/schema/conftest.py @@ -14,8 +14,7 @@ def auth_backend() -> AuthBackendInterface: class AuthSession(AuthBackendInterface): base_url = "https://base.url" - default_data_partition_id = "osdu" - default_tenant = "osdu" + default_data_partition_id = "osdu" authorization_header = {"Authorization": "Bearer access_token"} diff --git a/tests/sdms/conftest.py b/tests/sdms/conftest.py index a2cd194..927d9fe 100644 --- a/tests/sdms/conftest.py +++ b/tests/sdms/conftest.py @@ -14,8 +14,7 @@ def auth_backend() -> AuthBackendInterface: class AuthSession(AuthBackendInterface): base_url = "https://base.url" - default_data_partition_id = "osdu" - default_tenant = "osdu" + default_data_partition_id = "osdu" authorization_header = {"Authorization": "Bearer access_token"} diff --git a/tests/search/conftest.py b/tests/search/conftest.py index 0a8644e..25014e5 100644 --- a/tests/search/conftest.py +++ b/tests/search/conftest.py @@ -14,8 +14,7 @@ def auth_backend() -> AuthBackendInterface: class AuthSession(AuthBackendInterface): base_url = "https://base.url" - default_data_partition_id = "osdu" - default_tenant = "osdu" + default_data_partition_id = "osdu" authorization_header = {"Authorization": "Bearer access_token"} diff --git a/tests/secret/conftest.py b/tests/secret/conftest.py index 2e0ac96..ef2876e 100644 --- a/tests/secret/conftest.py +++ b/tests/secret/conftest.py @@ -14,8 +14,7 @@ def auth_backend() -> AuthBackendInterface: class AuthSession(AuthBackendInterface): base_url = "https://base.url" - default_data_partition_id = "osdu" - default_tenant = "osdu" + default_data_partition_id = "osdu" authorization_header = {"Authorization": "Bearer access_token"} def get_sd_connection_params(self): diff --git a/tests/storage/conftest.py b/tests/storage/conftest.py index 6fdca6b..1e0bfad 100644 --- a/tests/storage/conftest.py +++ b/tests/storage/conftest.py @@ -15,7 +15,6 @@ def auth_backend() -> AuthBackendInterface: class AuthSession(AuthBackendInterface): base_url = "https://base.url" default_data_partition_id = "osdu" - default_tenant = "osdu" authorization_header = {"Authorization": "Bearer access_token"} diff --git a/tests/wellbore/conftest.py b/tests/wellbore/conftest.py index 6ad77dc..5c463d3 100644 --- a/tests/wellbore/conftest.py +++ b/tests/wellbore/conftest.py @@ -15,7 +15,6 @@ def auth_backend() -> AuthBackendInterface: class AuthSession(AuthBackendInterface): base_url = "https://base.url" default_data_partition_id = "osdu" - default_tenant = "osdu" authorization_header = {"Authorization": "Bearer access_token"} diff --git a/tests/welldelivery/conftest.py b/tests/welldelivery/conftest.py index c7c5c7b..45e216a 100644 --- a/tests/welldelivery/conftest.py +++ b/tests/welldelivery/conftest.py @@ -15,7 +15,6 @@ def auth_backend() -> AuthBackendInterface: class AuthSession(AuthBackendInterface): base_url = "https://base.url" default_data_partition_id = "osdu" - default_tenant = "osdu" authorization_header = {"Authorization": "Bearer access_token"}