mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-14 20:18:02 +00:00
Add test for the stats
This commit is contained in:
@@ -4,6 +4,7 @@ Test our views in ivatar.ivataraccount.views and ivatar.views
|
|||||||
"""
|
"""
|
||||||
# pylint: disable=too-many-lines
|
# pylint: disable=too-many-lines
|
||||||
import os
|
import os
|
||||||
|
import json
|
||||||
import django
|
import django
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.test import Client
|
from django.test import Client
|
||||||
@@ -54,3 +55,19 @@ class Tester(TestCase): # pylint: disable=too-many-public-methods
|
|||||||
expected_url="/static/img/deadbeef.png",
|
expected_url="/static/img/deadbeef.png",
|
||||||
msg_prefix="Why does an invalid hash not redirect to deadbeef?",
|
msg_prefix="Why does an invalid hash not redirect to deadbeef?",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_stats(self):
|
||||||
|
"""
|
||||||
|
Test incorrect digest
|
||||||
|
"""
|
||||||
|
response = self.client.get("/stats/", follow=True)
|
||||||
|
self.assertEqual(response.status_code, 200, "unable to fetch stats!")
|
||||||
|
j = json.loads(response.content)
|
||||||
|
self.assertEqual(j["users"], 1, "user count incorrect")
|
||||||
|
self.assertEqual(j["mails"], 0, "mails count incorrect")
|
||||||
|
self.assertEqual(j["openids"], 0, "openids count incorrect")
|
||||||
|
self.assertEqual(j["unconfirmed_mails"], 0, "unconfirmed mails count incorrect")
|
||||||
|
self.assertEqual(
|
||||||
|
j["unconfirmed_openids"], 0, "unconfirmed openids count incorrect"
|
||||||
|
)
|
||||||
|
self.assertEqual(j["avatars"], 0, "avatars count incorrect")
|
||||||
|
|||||||
Reference in New Issue
Block a user