From 06b39b813116360ea669a6de6bc4b51317ed5b5f Mon Sep 17 00:00:00 2001 From: scallec Date: Thu, 28 Mar 2024 14:58:09 +0100 Subject: [PATCH] test cleaning --- tests/aio/test_connector.py | 11 +++-------- tests/connectors/test_connector.py | 7 +------ 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/tests/aio/test_connector.py b/tests/aio/test_connector.py index 9012de1..967c313 100644 --- a/tests/aio/test_connector.py +++ b/tests/aio/test_connector.py @@ -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 @@ -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( @@ -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, @@ -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, diff --git a/tests/connectors/test_connector.py b/tests/connectors/test_connector.py index 5384185..78079b2 100644 --- a/tests/connectors/test_connector.py +++ b/tests/connectors/test_connector.py @@ -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() @@ -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"]})