diff --git a/tests/unit/connector/fal_tmp.py b/tests/unit/connector/fal_tmp.py deleted file mode 100644 index 269229663..000000000 --- a/tests/unit/connector/fal_tmp.py +++ /dev/null @@ -1,20 +0,0 @@ -import json -import falcon - -class Resource: - def on_get(self, req, resp): - doc = { - 'images': [ - { - 'href': '/images/1eaf6ef1-7f2d-4ecc-a8d5-6e8adba7cc0e.png' - } - ] - } - - # Create a JSON representation of the resource - resp.text = json.dumps(doc, ensure_ascii=False) - - # The following line can be omitted because 200 is the default - # status returned by the framework, but it is included here to - # illustrate how this may be overridden as needed. - resp.status = falcon.HTTP_500 \ No newline at end of file diff --git a/tests/unit/connector/test_http_input.py b/tests/unit/connector/test_http_input.py index e11f44c8a..7bd9a094e 100644 --- a/tests/unit/connector/test_http_input.py +++ b/tests/unit/connector/test_http_input.py @@ -263,9 +263,7 @@ def test_get_metadata(self): connector.pipeline_index = 1 connector.setup() target = connector.target - # Todo: gibt es hier eine Lösung? - resp = requests.post(url=f"{target}/json", json=message, timeout=0.5) # nosemgrep - #resp = self.falconClient.simulate_post('/json', json=message) + resp = requests.post(url=f"{target}/json", json=message, timeout=0.5) assert resp.status_code == 200 message = connector.messages.get(timeout=0.5) assert message["custom"]["url"] == target + "/json" @@ -273,7 +271,6 @@ def test_get_metadata(self): assert isinstance(message["custom"]["user_agent"], str) def test_server_multiple_config_changes(self): - # Todo: abklären hier request zu lassen -> comments entfernen message = {"message": "my message"} connector_config = deepcopy(self.CONFIG) connector_config["uvicorn_config"]["port"] = 9001 @@ -281,13 +278,11 @@ def test_server_multiple_config_changes(self): connector.pipeline_index = 1 connector.setup() target = connector.target - #resp = self.client.simulate_post('/json', json=message) - resp = requests.post(url=f"{target}/json", json=message, timeout=0.5) # nosemgrep + resp = requests.post(url=f"{target}/json", json=message, timeout=0.5) assert resp.status_code == 200 target = target.replace(":9001", ":9000") try: - #resp = self.client.simulate_post('/json', json=message) - resp = requests.post(url=f"{target}/json", json=message, timeout=0.5) # nosemgrep + resp = requests.post(url=f"{target}/json", json=message, timeout=0.5) except requests.exceptions.ConnectionError as e: assert e.response is None connector_config = deepcopy(self.CONFIG) @@ -295,8 +290,7 @@ def test_server_multiple_config_changes(self): connector.pipeline_index = 1 connector.setup() target = connector.target - resp = requests.post(url=f"{target}/json", json=message, timeout=0.5) # nosemgrep - # resp = self.client.simulate_post('/json', json=message) + resp = requests.post(url=f"{target}/json", json=message, timeout=0.5) assert resp.status_code == 200 def test_get_next_with_hmac_of_raw_message(self): @@ -316,8 +310,6 @@ def test_get_next_with_hmac_of_raw_message(self): connector.pipeline_index = 1 connector.setup() test_event = "the content" - # Todo: comment entfernen - # requests.post(url=f"{self.target}/plaintext", data=test_event, timeout=0.5) # nosemgrep self.client.simulate_post('/plaintext', body=test_event) expected_event = { @@ -340,12 +332,9 @@ def test_endpoint_returns_401_if_authorization_not_provided(self, credentials_fi resp = requests.post( url=f"{self.target}/auth-json-file", timeout=0.5, data=json.dumps(data) ) - # Todo: gibt es eine Lösung? - #resp = self.falconClient.simulate_post('/auth-json-file', body=json.dumps(data)) assert resp.status_code == 401 def test_endpoint_returns_401_on_wrong_authorization(self, credentials_file_path): - # Todo: was machen mit auth? mock_env = {ENV_NAME_LOGPREP_CREDENTIALS_FILE: credentials_file_path} data = {"message": "my log message"} with mock.patch.dict("os.environ", mock_env): @@ -363,7 +352,6 @@ def test_endpoint_returns_200_on_correct_authorization_with_password_from_file( ): mock_env = {ENV_NAME_LOGPREP_CREDENTIALS_FILE: credentials_file_path} data = {"message": "my log message"} - # Todo: was machen mit auth? with mock.patch.dict("os.environ", mock_env): new_connector = Factory.create({"test connector": self.CONFIG}) new_connector.pipeline_index = 1 @@ -378,7 +366,6 @@ def test_endpoint_returns_200_on_correct_authorization_with_password_within_cred self, credentials_file_path ): mock_env = {ENV_NAME_LOGPREP_CREDENTIALS_FILE: credentials_file_path} - # Todo: was machen mit auth? data = {"message": "my log message"} with mock.patch.dict("os.environ", mock_env): new_connector = Factory.create({"test connector": self.CONFIG}) @@ -393,7 +380,6 @@ def test_endpoint_returns_200_on_correct_authorization_with_password_within_cred def test_endpoint_returns_200_on_correct_authorization_for_subpath(self, credentials_file_path): mock_env = {ENV_NAME_LOGPREP_CREDENTIALS_FILE: credentials_file_path} data = {"message": "my log message"} - # Todo: was machen mit auth? with mock.patch.dict("os.environ", mock_env): new_connector = Factory.create({"test connector": self.CONFIG}) new_connector.pipeline_index = 1