Skip to content

Commit ef1dc94

Browse files
committed
test: upgrade test to latest version of eventsourcingdb
1 parent d5a77a2 commit ef1dc94

File tree

19 files changed

+75
-55
lines changed

19 files changed

+75
-55
lines changed

eventsourcingdb_client_python/handlers/observe_events/observe_events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async def observe_events(
5050
response: Response
5151
try:
5252
response = await client.http_client.post(
53-
path='/api/observe-events',
53+
path='/api/v1/observe-events',
5454
request_body=request_body,
5555
)
5656
except CustomError as custom_error:
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
from http import HTTPStatus
2+
import json
23

34
from ..abstract_base_client import AbstractBaseClient
45
from ..errors.server_error import ServerError
56

6-
77
async def ping(client: AbstractBaseClient) -> None:
8-
response = await client.http_client.get('/api/ping')
8+
response = await client.http_client.get('/api/v1/ping')
99
response_body = bytes.decode(await response.body.read(), encoding='utf-8')
1010

11-
if response.status_code != HTTPStatus.OK or response_body != HTTPStatus.OK.phrase:
12-
raise ServerError(f'Received unexpected response: {response_body}')
11+
"""if response.status_code != HTTPStatus.OK or response_body != HTTPStatus.OK.phrase:
12+
raise ServerError(f'Received unexpected response: {response_body}')"""
13+
14+
try:
15+
response_json = json.loads(response_body)
16+
except json.JSONDecodeError:
17+
pass
18+
else:
19+
if isinstance(response_json, dict) and response_json.get('status') == 'ok':
20+
return
21+
# Wenn weder altes noch neues Format passt
22+
raise ServerError(f'Received unexpected response: {response_body}')

eventsourcingdb_client_python/handlers/read_event_types/read_event_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async def read_event_types(
2323
response: Response
2424
try:
2525
response = await client.http_client.post(
26-
path='/api/read-event-types',
26+
path='/api/v1/read-event-types',
2727
request_body='',
2828
)
2929
except CustomError as custom_error:

eventsourcingdb_client_python/handlers/read_events/read_events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async def read_events(
4949
response: Response
5050
try:
5151
response = await client.http_client.post(
52-
path='/api/read-events',
52+
path='/api/v1/read-events',
5353
request_body=request_body,
5454
)
5555
except CustomError as custom_error:

eventsourcingdb_client_python/handlers/read_subjects/read_subjects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ async def read_subjects(
3737
response: Response
3838
try:
3939
response = await client.http_client.post(
40-
path='/api/read-subjects',
40+
path='/api/v1/read-subjects',
4141
request_body=request_body,
4242
)
4343
except CustomError as custom_error:

eventsourcingdb_client_python/handlers/register_event_schema/register_event_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async def register_event_schema(
3333
response: Response
3434
try:
3535
response = await client.http_client.post(
36-
path='/api/register-event-schema',
36+
path='/api/v1/register-event-schema',
3737
request_body=request_body,
3838
)
3939
except CustomError as custom_error:

eventsourcingdb_client_python/handlers/write_events/write_events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ async def write_events(
4242
response: Response
4343
try:
4444
response = await client.http_client.post(
45-
path='/api/write-events',
45+
path='/api/v1/write-events',
4646
request_body=request_body,
4747
)
4848
except CustomError as custom_error:

tests/shared/containerized_testing_database.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ async def create(
2929
access_token: str,
3030
options: ClientOptions = ClientOptions(),
3131
) -> 'ContainerizedTestingDatabase':
32+
command.extend(['--http-enabled', '--https-enabled=false'])
3233
container = image.run(command, True, True)
3334
exposed_port = container.get_exposed_port(3_000)
3435
base_url = f'http://127.0.0.1:{exposed_port}'

tests/shared/database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async def create(cls) -> 'Database':
3030
access_token = str(uuid.uuid4())
3131
with_authorization = await ContainerizedTestingDatabase.create(
3232
image,
33-
['run', '--access-token', f'{access_token}', '--store-temporary'],
33+
['run', '--api-token', f'{access_token}', '--data-directory-temporary'],
3434
access_token,
3535
ClientOptions()
3636
)

tests/shared/docker/container.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def kill(self) -> None:
2020
raise DockerCommandFailedError(
2121
f'Kill failed with output: {stderr}')
2222

23-
def get_exposed_port(self, internal_port: int) -> int:
23+
def get_exposed_port(self, internal_port: int = 3_000) -> int:
2424
docker_command = [
2525
'docker',
2626
'inspect',

0 commit comments

Comments
 (0)