vbv/server/vbv_lernwelt/notify/tests/test_create_default_notific...

20 lines
784 B
Python

from django.test import TestCase
from vbv_lernwelt.core.admin import User
from vbv_lernwelt.core.tests.factories import UserFactory
from vbv_lernwelt.notify.create_default_notifications import (
create_default_notifications,
)
from vbv_lernwelt.notify.models import Notification
class TestCreateDefaultNotifications(TestCase):
def test_create_default_notifications(self):
UserFactory(username="John Doe", email="john.doe@gmail.com")
UserFactory(username="Ruedi Hürzeler", email="ruediboy69@gmail.com")
notifications_per_user = create_default_notifications()
notifications = Notification.objects.all()
expected_count = User.objects.all().count() * notifications_per_user
self.assertEqual(len(notifications), expected_count)