Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 9ebf19b

Browse files
mock
1 parent 34c1039 commit 9ebf19b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

api/gen_ai/tests/test_gen_ai.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def sign_payload(data: bytes, secret=PAYLOAD_SECRET):
1919

2020

2121
class GenAIAuthViewTests(APITestCase):
22-
@patch("utils.config.get_config", return_value=PAYLOAD_SECRET)
22+
@patch("api.gen_ai.views.get_config", return_value=PAYLOAD_SECRET)
2323
def test_missing_parameters(self, mock_config):
2424
payload = b"{}"
2525
sig, data = sign_payload(payload)
@@ -32,7 +32,7 @@ def test_missing_parameters(self, mock_config):
3232
self.assertEqual(response.status_code, 400)
3333
self.assertIn("Missing required parameters", response.data)
3434

35-
@patch("utils.config.get_config", return_value=PAYLOAD_SECRET)
35+
@patch("api.gen_ai.views.get_config", return_value=PAYLOAD_SECRET)
3636
def test_invalid_signature(self, mock_config):
3737
# Correct payload
3838
payload = b'{"external_owner_id":"owner1","repo_service_id":"101"}'
@@ -46,7 +46,7 @@ def test_invalid_signature(self, mock_config):
4646
)
4747
self.assertEqual(response.status_code, 403)
4848

49-
@patch("utils.config.get_config", return_value=PAYLOAD_SECRET)
49+
@patch("api.gen_ai.views.get_config", return_value=PAYLOAD_SECRET)
5050
def test_owner_not_found(self, mock_config):
5151
payload = b'{"external_owner_id":"nonexistent_owner","repo_service_id":"101"}'
5252
sig, data = sign_payload(payload)
@@ -58,7 +58,7 @@ def test_owner_not_found(self, mock_config):
5858
)
5959
self.assertEqual(response.status_code, 404)
6060

61-
@patch("utils.config.get_config", return_value=PAYLOAD_SECRET)
61+
@patch("api.gen_ai.views.get_config", return_value=PAYLOAD_SECRET)
6262
def test_no_installation(self, mock_config):
6363
# Create a valid owner but no installation
6464
OwnerFactory(service="github", service_id="owner1", username="test1")
@@ -73,7 +73,7 @@ def test_no_installation(self, mock_config):
7373
self.assertEqual(response.status_code, 200)
7474
self.assertEqual(response.data, {"is_valid": False})
7575

76-
@patch("utils.config.get_config", return_value=PAYLOAD_SECRET)
76+
@patch("api.gen_ai.views.get_config", return_value=PAYLOAD_SECRET)
7777
def test_authorized(self, mock_config):
7878
owner = OwnerFactory(service="github", service_id="owner2", username="test2")
7979
GithubAppInstallation.objects.create(
@@ -93,7 +93,7 @@ def test_authorized(self, mock_config):
9393
self.assertEqual(response.status_code, status.HTTP_200_OK)
9494
self.assertEqual(response.data, {"is_valid": True})
9595

96-
@patch("utils.config.get_config", return_value=PAYLOAD_SECRET)
96+
@patch("api.gen_ai.views.get_config", return_value=PAYLOAD_SECRET)
9797
def test_unauthorized(self, mock_config):
9898
owner = OwnerFactory(service="github", service_id="owner3", username="test3")
9999
GithubAppInstallation.objects.create(

api/gen_ai/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class GenAIAuthView(APIView):
2121

2222
def validate_signature(self, request):
2323
key = get_config(
24-
"gen_ai", "auth_secret", default=b"testixik8qdauiab1yiffydimvi72ekq"
24+
"gen_ai", "auth_secret"
2525
)
2626
if not key:
2727
raise PermissionDenied("Invalid signature")

0 commit comments

Comments
 (0)