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

fix: Removed unused tenant in auth interface #3

Merged
merged 1 commit into from
Jul 26, 2024
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions gen/tests_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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):",
Expand Down
13 changes: 2 additions & 11 deletions osdu_client/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
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 = "osdu-client"
version = "1.2.0"
version = "1.3.0"
description = "OSDU API Client"
authors = ["Michal Murawski <[email protected]>"]
readme = "README.md"
Expand Down
Empty file removed tests/conftest.py
Empty file.
1 change: 0 additions & 1 deletion tests/dataset/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}


Expand Down
1 change: 0 additions & 1 deletion tests/entitlements/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}


Expand Down
1 change: 0 additions & 1 deletion tests/file/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}


Expand Down
3 changes: 1 addition & 2 deletions tests/indexer/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}


Expand Down
3 changes: 1 addition & 2 deletions tests/legal/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}


Expand Down
1 change: 0 additions & 1 deletion tests/notification/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}


Expand Down
3 changes: 1 addition & 2 deletions tests/partition/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}


Expand Down
3 changes: 1 addition & 2 deletions tests/policy/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}


Expand Down
1 change: 0 additions & 1 deletion tests/pws/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}


Expand Down
3 changes: 1 addition & 2 deletions tests/rafs/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}


Expand Down
3 changes: 1 addition & 2 deletions tests/register/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}


Expand Down
3 changes: 1 addition & 2 deletions tests/schema/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}


Expand Down
3 changes: 1 addition & 2 deletions tests/sdms/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}


Expand Down
3 changes: 1 addition & 2 deletions tests/search/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}


Expand Down
3 changes: 1 addition & 2 deletions tests/secret/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 0 additions & 1 deletion tests/storage/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}


Expand Down
1 change: 0 additions & 1 deletion tests/wellbore/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}


Expand Down
1 change: 0 additions & 1 deletion tests/welldelivery/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}


Expand Down
Loading