From 64ce9953cefcdd16b7cd73af6f5821d1b352bd5b Mon Sep 17 00:00:00 2001 From: iamprecieee Date: Fri, 21 Feb 2025 04:01:59 +0100 Subject: [PATCH 1/5] fix(ci): fix attempt at installation errors - added default values for settings config --- src/config/config.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/config/config.py b/src/config/config.py index 410dbc1..7df8dd5 100644 --- a/src/config/config.py +++ b/src/config/config.py @@ -3,17 +3,17 @@ class Settings(BaseSettings): - allowed_origins: str - allowed_hosts: str - host: str - port: int - reload_value: str - telex_webhook_url: str + allowed_origins: str = "http://test" + allowed_hosts: str = "test" + host: str = "127.0.0.1" + port: int = 8000 + reload_value: str = "true" + telex_webhook_url: str = "https://example.com/telex" curl_command: str | None = "curl" # might require path/to/curl e.g. `/usr/bin/curl` - app_logo_url: str - app_url: str - target_url: str - background_color_hexcode: str + app_logo_url: str = "https://example.com/logo.png" + app_url: str = "https://example.com" + target_url: str = "https://example.com/target" + background_color_hexcode: str = "#FFFFFF" model_config = SettingsConfigDict(env_file=".env") From 5187b5bf0b954185f969af05152f28fac4cc32fd Mon Sep 17 00:00:00 2001 From: iamprecieee Date: Fri, 21 Feb 2025 04:08:27 +0100 Subject: [PATCH 2/5] fix(ci): fix attempt at installation errors - add sample commit to test --- tests/test_github.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_github.py b/tests/test_github.py index da1cceb..a6305be 100644 --- a/tests/test_github.py +++ b/tests/test_github.py @@ -8,7 +8,13 @@ def test_send_to_telex_success(): json={ "pusher": {"name": "test"}, "commits": [ - {"key": "value"}, + { + "id": "commit_hash", + "message": "commit_message", + "timestamp": "iso_timestamp", + "url": "commit_url", + "author": {"name": "author_name", "email": "author_email"} + } ], }, ) From 3bfaad0679664dceaa3dd9b0cca3228d56b24e1e Mon Sep 17 00:00:00 2001 From: iamprecieee Date: Fri, 21 Feb 2025 04:11:00 +0100 Subject: [PATCH 3/5] fix(ci): fix attempt at installation errors - add channel id value --- tests/test_github.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_github.py b/tests/test_github.py index a6305be..3c660ec 100644 --- a/tests/test_github.py +++ b/tests/test_github.py @@ -4,7 +4,7 @@ def test_send_to_telex_success(): response = client.post( - "/webhook/github/{telex_channel_id}", # Replace with an existing channel ID to receive messages + "/webhook/github/0195114c-3869-7b9f-b727-171712ccb073", # Replace with an existing channel ID to receive messages json={ "pusher": {"name": "test"}, "commits": [ From b5dd8be681625a212d6801741a5cb159a2c679e4 Mon Sep 17 00:00:00 2001 From: iamprecieee Date: Fri, 21 Feb 2025 04:20:39 +0100 Subject: [PATCH 4/5] fix(ci): fix attempt at installation errors -print out errors on ci test --- .github/workflows/pytest.yml | 2 +- tests/test_github.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index e13a6b4..427248d 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -24,4 +24,4 @@ jobs: - name: run tests run: | - pytest \ No newline at end of file + pytest -s \ No newline at end of file diff --git a/tests/test_github.py b/tests/test_github.py index 3c660ec..d5132cf 100644 --- a/tests/test_github.py +++ b/tests/test_github.py @@ -4,24 +4,25 @@ def test_send_to_telex_success(): response = client.post( - "/webhook/github/0195114c-3869-7b9f-b727-171712ccb073", # Replace with an existing channel ID to receive messages + "/webhook/github/{telex_channel_id}", # Replace with an existing channel ID to receive messages json={ "pusher": {"name": "test"}, "commits": [ { "id": "commit_hash", "message": "commit_message", - "timestamp": "iso_timestamp", + "timestamp": "2025-02-18T10:17:54+01:00", "url": "commit_url", "author": {"name": "author_name", "email": "author_email"} } ], }, ) - assert response.status_code == 200 + # assert response.status_code == 200 response_data = json.loads(response.content.decode()) - assert response_data["data"]["status"] == "success" - assert response_data["data"]["status_code"] == 202 + print(response_data) + # assert response_data["data"]["status"] == "success" + # assert response_data["data"]["status_code"] == 202 def test_send_to_telex_failure(): From 5f06e9d40f72c5f005df9a8ffeb177dba01267d2 Mon Sep 17 00:00:00 2001 From: iamprecieee Date: Fri, 21 Feb 2025 04:25:56 +0100 Subject: [PATCH 5/5] fix(ci): fix test run errors -added correct webhook url for telex to config --- .github/workflows/pytest.yml | 2 +- src/config/config.py | 2 +- tests/test_github.py | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 427248d..e13a6b4 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -24,4 +24,4 @@ jobs: - name: run tests run: | - pytest -s \ No newline at end of file + pytest \ No newline at end of file diff --git a/src/config/config.py b/src/config/config.py index 7df8dd5..6b83ab0 100644 --- a/src/config/config.py +++ b/src/config/config.py @@ -8,7 +8,7 @@ class Settings(BaseSettings): host: str = "127.0.0.1" port: int = 8000 reload_value: str = "true" - telex_webhook_url: str = "https://example.com/telex" + telex_webhook_url: str = "https://ping.telex.im/v1/webhooks" curl_command: str | None = "curl" # might require path/to/curl e.g. `/usr/bin/curl` app_logo_url: str = "https://example.com/logo.png" app_url: str = "https://example.com" diff --git a/tests/test_github.py b/tests/test_github.py index d5132cf..9374157 100644 --- a/tests/test_github.py +++ b/tests/test_github.py @@ -18,11 +18,10 @@ def test_send_to_telex_success(): ], }, ) - # assert response.status_code == 200 + assert response.status_code == 200 response_data = json.loads(response.content.decode()) - print(response_data) - # assert response_data["data"]["status"] == "success" - # assert response_data["data"]["status_code"] == 202 + assert response_data["data"]["status"] == "success" + assert response_data["data"]["status_code"] == 202 def test_send_to_telex_failure():