mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-28 23:43:22 +00:00
feat: Création de tests unitaires pour le back[#63]
This commit is contained in:
22
Back-End/GestionNotification/tests.py
Normal file
22
Back-End/GestionNotification/tests.py
Normal file
@ -0,0 +1,22 @@
|
||||
from django.test import TestCase
|
||||
from .models import Notification, TypeNotif
|
||||
from Auth.models import Profile
|
||||
|
||||
class NotificationModelTest(TestCase):
|
||||
def setUp(self):
|
||||
self.user = Profile.objects.create_user(
|
||||
username="notifuser",
|
||||
email="notif@example.com",
|
||||
password="testpass123"
|
||||
)
|
||||
|
||||
def test_create_notification(self):
|
||||
notif = Notification.objects.create(
|
||||
user=self.user,
|
||||
message="Un message a été reçu",
|
||||
typeNotification=TypeNotif.NOTIF_MESSAGE
|
||||
)
|
||||
self.assertEqual(notif.user, self.user)
|
||||
self.assertEqual(notif.message, "Un message a été reçu")
|
||||
self.assertFalse(notif.is_read)
|
||||
self.assertEqual(notif.typeNotification, TypeNotif.NOTIF_MESSAGE)
|
||||
Reference in New Issue
Block a user