Skip to content

Commit

Permalink
assertLog instead
Browse files Browse the repository at this point in the history
  • Loading branch information
jacodottech committed Feb 24, 2025
1 parent fd03bae commit 111833c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion web_iconify_proxy/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Credits
Authors
-------

* Jaco
* jaco.tech

Contributors
------------
Expand Down
5 changes: 4 additions & 1 deletion web_iconify_proxy/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2025 jaco.tech
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Web Iconify Proxy",
"summary": "Proxies requests to the Iconify API, providing SVG icons, CSS,"
Expand All @@ -6,7 +9,7 @@
"version": "18.0.1.0.0",
"category": "Website",
"website": "https://github.com/OCA/web",
"author": "Odoo Community Association (OCA), Jaco",
"author": "jaco.tech, Odoo Community Association (OCA)",
"license": "LGPL-3",
"depends": ["web"],
"data": [],
Expand Down
2 changes: 1 addition & 1 deletion web_iconify_proxy/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ <h1><a class="toc-backref" href="#toc-entry-5">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-6">Authors</a></h2>
<ul class="simple">
<li>Jaco</li>
<li>jaco.tech</li>
</ul>
</div>
<div class="section" id="contributors">
Expand Down
17 changes: 4 additions & 13 deletions web_iconify_proxy/tests/test_main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import base64
import logging
from unittest.mock import patch

import requests
Expand All @@ -10,16 +9,6 @@

@tagged("post_install", "-at_install")
class TestIconifyProxyController(HttpCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
logging.disable(logging.CRITICAL)

@classmethod
def tearDownClass(cls):
super().tearDownClass()
logging.disable(logging.NOTSET)

@patch("odoo.addons.web_iconify_proxy.controllers.main.requests.get")
def test_get_svg_success(self, mock_get):
mock_response = requests.Response()
Expand Down Expand Up @@ -144,5 +133,7 @@ def test_caching(self, mock_get):
def test_api_error(self, mock_get):
# Mock requests.get to simulate an API error
mock_get.side_effect = requests.exceptions.RequestException("Simulated Error")
response = self.url_open("/web_iconify_proxy/mdi/home.svg")
self.assertEqual(response.status_code, 404) # Expect 404 Not Found
with self.assertLogs(level="ERROR") as log:
response = self.url_open("/web_iconify_proxy/mdi/home.svg")
self.assertEqual(response.status_code, 404) # Expect 404 Not Found
self.assertIn("Simulated Error", log.output[0])

0 comments on commit 111833c

Please sign in to comment.