Skip to content

Commit

Permalink
fixup! Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaniszewska-dev committed Oct 10, 2023
1 parent d500750 commit b0e5817
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion pingen/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Author: Guewen Baconnier
# Copyright 2012-2017 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import controllers
from . import models
2 changes: 0 additions & 2 deletions pingen/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

class PingenController(http.Controller):
def _verify_signature(self, request_content):
if config["test_enable"]:
return True
webhook_signature = http.request.httprequest.headers.get("Signature")
companies = http.request.env["res.company"].sudo().search([])
for company in companies:
Expand Down
1 change: 0 additions & 1 deletion pingen/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Copyright 2018 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import ir_attachment
from . import pingen
Expand Down
1 change: 0 additions & 1 deletion pingen/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Copyright 2023 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from . import test_pingen
5 changes: 4 additions & 1 deletion pingen/tests/test_pingen.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,10 @@ def test_pingen_push_document(self):
pingen_document.pingen_uuid
)
mock_request.httprequest.method = "POST"
self.pc.letter_issues()
# avoid checking signature when calling webhooks
with patch("odoo.addons.pingen.controllers.main.PingenController._verify_signature") as mocked_verify_sign:
mocked_verify_sign.return_value = True
self.pc.letter_issues()

self.assertEqual(pingen_document.state, "pingen_error")
self.assertEqual(pingen_document.last_error_message, "Validation failed")

0 comments on commit b0e5817

Please sign in to comment.