Skip to content

Commit

Permalink
[IMP] Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edescalona committed Dec 3, 2024
1 parent f3966e6 commit 55792e0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions website_recaptcha_v2_login/tests/test_recaptcha.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from unittest import mock

from odoo.exceptions import AccessDenied
from odoo.tests import common

imp_requests = "odoo.addons.website_recaptcha_v2.models.website.requests"
Expand All @@ -25,3 +26,9 @@ def test_captcha_valid(self, requests_mock):
{"g-recaptcha-response": "dummy_response"}
)
self.assertTrue(result)

@mock.patch(imp_requests)
def test_captcha_not_valid(self, requests_mock):
requests_mock.post().json.return_value = {"success": False}
with self.assertRaises(AccessDenied):
self.website.valid_recaptcha({"g-recaptcha-response": ""})

0 comments on commit 55792e0

Please sign in to comment.