diff --git a/.gitignore b/.gitignore index 7216a168..e3ee2e4b 100644 --- a/.gitignore +++ b/.gitignore @@ -159,6 +159,7 @@ cython_debug/ #.idea/ .vscode/launch.json +.vscode/settings.json chirps/erl_crash.dump *.dump diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 640fb200..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "python.testing.pytestArgs": [ - "chirps" - ], - "python.testing.unittestEnabled": false, - "python.testing.pytestEnabled": true -} \ No newline at end of file diff --git a/chirps/target/templates/target/dashboard.html b/chirps/target/templates/target/dashboard.html index 762f5447..34bbbbd1 100644 --- a/chirps/target/templates/target/dashboard.html +++ b/chirps/target/templates/target/dashboard.html @@ -63,45 +63,45 @@
{{ target.name }}
{% endfor %} - -
-
-
- Notification - -
-
- -
-
-
- + +
+
+
+ Notification + +
+
+ +
+
+
+ {% include 'pagination.html' with page_obj=page_obj %} diff --git a/chirps/target/tests.py b/chirps/target/tests.py index 300cf69a..e38dea6e 100644 --- a/chirps/target/tests.py +++ b/chirps/target/tests.py @@ -1,15 +1,15 @@ """Test cases for the target application.""" from unittest import mock + +import fakeredis +import pytest from django.contrib.auth.models import User # noqa: E5142 from django.test import TestCase from django.urls import reverse -import fakeredis -import pytest +from redis.exceptions import ConnectionError from target.providers.mantium import MantiumTarget from target.providers.redis import RedisTarget -from redis.exceptions import ConnectionError - class TargetTests(TestCase): """Test the target application.""" @@ -119,6 +119,7 @@ class RedisTargetTests(TestCase): """Test the RedisTarget""" def setUp(self): + """Set up the RedisTarget tests""" # Login the user before performing any tests self.client.post(reverse('login'), {'username': 'admin', 'password': 'admin'}) self.server = fakeredis.FakeServer() @@ -127,7 +128,7 @@ def setUp(self): def test_ping__success(self): """Test that connectivity check works""" self.server.connected = True - + with mock.patch('target.providers.redis.Redis', return_value=self.redis): target = RedisTarget(host='localhost', port=12000) assert target.test_connection() @@ -135,7 +136,7 @@ def test_ping__success(self): def test_ping__failure(self): """Test that ping raises ConnectionError if the server is not connected""" self.server.connected = False - + with mock.patch('target.providers.redis.Redis', return_value=self.redis): target = RedisTarget(host='localhost', port=12000) with pytest.raises(ConnectionError): diff --git a/requirements.txt b/requirements.txt index 52f41f72..46ef4286 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,3 +8,4 @@ redis==4.5.5 requests==2.31.0 pinecone-client python-dotenv +fakeredis==2.16.0