Skip to content

Commit

Permalink
test cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
StephKll3c committed Mar 28, 2024
1 parent f6ce5e4 commit 06b39b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
11 changes: 3 additions & 8 deletions tests/aio/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,6 @@ async def test_async_connector_client_session(async_connector: DummyAsyncConnect
other_instance.set_client_session(None)


@patch(
"builtins.open",
new_callable=mock_open,
read_data=json.dumps({"intake_url": "https://intake.sekoia.io"}),
)
@pytest.mark.asyncio
async def test_async_connector_push_single_event(
async_connector: DummyAsyncConnector, faker: Faker
Expand All @@ -122,7 +117,7 @@ async def test_async_connector_push_single_event(

single_event_id = faker.uuid4()

request_url = urljoin("https://intake.sekoia.io", "batch")
request_url = urljoin(async_connector.configuration.intake_server, "batch")

with aioresponses() as mocked_responses:
mocked_responses.post(
Expand Down Expand Up @@ -161,7 +156,7 @@ async def test_async_connector_push_multiple_events(

single_event_id = faker.uuid4()

request_url = urljoin("https://intake.sekoia.io", "batch")
request_url = urljoin(async_connector.configuration.intake_server, "batch")

with (
aioresponses() as mocked_responses,
Expand Down Expand Up @@ -206,7 +201,7 @@ async def test_async_connector_raise_error(
stop=stop_after_attempt(1),
)

request_url = urljoin("https://intake.sekoia.io", "batch")
request_url = urljoin(async_connector.configuration.intake_server, "batch")

with (
aioresponses() as mocked_responses,
Expand Down
7 changes: 1 addition & 6 deletions tests/connectors/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_connector(storage, mocked_trigger_logs):
test_connector.send_event = Mock()

test_connector.trigger_activation = "2022-03-14T11:16:14.236930Z"
test_connector.configuration = {"intake_key": ""}
test_connector.configuration = {"intake_key": "", "intake_server": "https://intake.sekoia.io"}

test_connector.log = Mock()
test_connector.log_exception = Mock()
Expand Down Expand Up @@ -105,11 +105,6 @@ def test_chunk_events_discard_too_long_message(test_connector):
assert test_connector.log.called


@patch(
"builtins.open",
new_callable=mock_open,
read_data=json.dumps({"intake_url": "https://intake.sekoia.io/batch"}),
)
def test_push_event_to_intake_with_2_events(test_connector, mocked_trigger_logs):
url = "https://intake.sekoia.io/batch"
mocked_trigger_logs.post(url, json={"event_ids": ["001", "002"]})
Expand Down

0 comments on commit 06b39b8

Please sign in to comment.