Skip to content

Commit

Permalink
my first working tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnoutAllaert committed Mar 7, 2024
1 parent 49fd1c7 commit 287917d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
15 changes: 0 additions & 15 deletions api/tests.py

This file was deleted.

Empty file added api/tests/__init__.py
Empty file.
Empty file added api/tests/models/__init__.py
Empty file.
16 changes: 16 additions & 0 deletions api/tests/models/test_gebruiker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from django.test import TestCase
from api.models.gebruiker import Gebruiker
from django.contrib.auth.models import User

class GebruikerTestCase(TestCase):
def setUp(self):
user1 = User.objects.create_user(username='user1')
user2 = User.objects.create_user(username='user2')
Gebruiker.objects.create(user=user1, is_lesgever=False)
Gebruiker.objects.create(user=user2, is_lesgever=True)

def test_gebruiker_is_lesgever(self):
user1 = Gebruiker.objects.get(user__username='user1')
user2 = Gebruiker.objects.get(user__username='user2')
self.assertEqual(user1.is_lesgever, False)
self.assertEqual(user2.is_lesgever, True)
5 changes: 3 additions & 2 deletions api/tests/test_views.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from django.test import TestCase
''' from django.test import TestCase
from django.urls import reverse
class TestViews(TestCase):
def test_should_show_register_page(self):
print('nigger')
#self.client.get(reverse('register'))
#self.assertEqual(response.status_code, 200)
#self.assertTemplateUsed(response, "authentication/register")
self.assertTrue(True)
self.assertTrue(True) '''

0 comments on commit 287917d

Please sign in to comment.