Skip to content

Commit ddd0098

Browse files
Noah Hummelgoloroden
andauthored
fix: make access token mandatory (#28)
* chore: update test dockerfile * chore: move access_token to positional parameters * chore: formatting --------- Co-authored-by: Golo Roden <[email protected]>
1 parent 3c1cd32 commit ddd0098

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

eventsourcingdb_client_python/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ class Client(AbstractBaseClient):
1919
def __init__(
2020
self,
2121
base_url: str,
22+
access_token: str,
2223
options: ClientOptions = ClientOptions()
2324
):
2425
self.configuration: ClientConfiguration = ClientConfiguration(
2526
base_url=base_url,
2627
timeout_seconds=options.timeout_seconds,
27-
access_token=options.access_token,
28+
access_token=access_token,
2829
protocol_version=options.protocol_version,
2930
max_tries=options.max_tries
3031
)

eventsourcingdb_client_python/client_options.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@
44
@dataclass
55
class ClientOptions:
66
timeout_seconds: int = 10
7-
access_token: str = ''
87
protocol_version: str = '1.0.0'
98
max_tries: int = 10

tests/shared/containerized_testing_database.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,20 @@ def __init__(
1010
self,
1111
image: Image,
1212
command: [str],
13+
access_token: str,
1314
options: ClientOptions = ClientOptions(),
1415
):
1516
self.__command: [str] = command
1617
self.__image: Image = image
17-
container, client = self.__start(options)
18+
container, client = self.__start(access_token, options)
1819
self.__client: Client = client
1920
self.__container: Container = container
2021

21-
def __start(self, options: ClientOptions) -> (Container, Client):
22+
def __start(self, access_token: str, options: ClientOptions) -> (Container, Client):
2223
container = self.__image.run(self.__command, True, True)
2324
exposed_port = container.get_exposed_port(3_000)
2425
base_url = f'http://127.0.0.1:{exposed_port}'
25-
client = Client(base_url, options)
26+
client = Client(base_url, access_token=access_token, options=options)
2627

2728
client.ping()
2829

tests/shared/database.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ def __init__(self):
1616
with_authorization = ContainerizedTestingDatabase(
1717
image,
1818
['run', '--access-token', f'{access_token}', '--store-temporary'],
19-
ClientOptions(access_token=access_token)
19+
access_token,
20+
ClientOptions()
2021
)
2122

22-
with_invalid_url = TestingDatabase(Client('http://localhost.invalid'))
23+
with_invalid_url = TestingDatabase(
24+
Client(base_url='http://localhost.invalid', access_token=access_token)
25+
)
2326

2427
self.with_authorization: ContainerizedTestingDatabase = with_authorization
2528
self.with_invalid_url: TestingDatabase = with_invalid_url

0 commit comments

Comments
 (0)