From 0e9083ee6307cc6032b364ec1097254bef2db265 Mon Sep 17 00:00:00 2001 From: Trey <73353716+TreyWW@users.noreply.github.com> Date: Wed, 27 Mar 2024 19:49:01 +0000 Subject: [PATCH] Slightly improved tests --- django_umami/tests.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/django_umami/tests.py b/django_umami/tests.py index 5ca65ce..5d7c180 100644 --- a/django_umami/tests.py +++ b/django_umami/tests.py @@ -3,10 +3,11 @@ from django.conf import settings from django.test import TestCase -from django_umami.core import Umami, UmamiConfig, UmamiEventData, UmamiPayload +from django_umami.core import Umami, UmamiConfig,UmamiResponse, UmamiEventData, UmamiPayload, umami +from django_umami.decorators import track, track_visit -class UmamiTestCase(TestCase): +class UmamiTests(TestCase): @classmethod def setUpClass(cls): @@ -60,10 +61,13 @@ def test_umami_track_invalid_event(self): with patch.object(self.umami, "send") as mocked_send: mocked_send.return_value.status_code = 200 - self.umami.track(123) + res = self.umami.track(123) mocked_send.assert_not_called() + # check if equals UmamiResponse(success=False, message="Invalid event data") + self.assertEqual(res, UmamiResponse(False, "Invalid event data")) + if __name__ == "__main__": unittest.main()