Skip to content

Commit

Permalink
Slightly improved tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TreyWW committed Mar 27, 2024
1 parent 7652d02 commit 0e9083e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions django_umami/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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()

0 comments on commit 0e9083e

Please sign in to comment.