forked from DGNum/gestioCOF
s/cofprofile/profile/g into k-fêt.
This commit also restores the only unittest present.
This commit is contained in:
parent
f39d1545f0
commit
22da04c3e2
9 changed files with 158 additions and 150 deletions
|
@ -1,3 +1,33 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
This file demonstrates writing tests using the unittest module. These will pass
|
||||
when you run "manage.py test".
|
||||
|
||||
Replace this with more appropriate tests for your application.
|
||||
"""
|
||||
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
from gestion.models import Profile, User
|
||||
|
||||
|
||||
class SimpleTest(TestCase):
|
||||
def test_delete_user(self):
|
||||
u = User(username='foo', first_name='foo', last_name='bar')
|
||||
|
||||
# to each user there's a cofprofile associated
|
||||
u.save()
|
||||
self.assertTrue(Profile.objects.filter(user__username='foo').exists())
|
||||
|
||||
# there's no point in having a cofprofile without a user associated.
|
||||
u.delete()
|
||||
self.assertFalse(Profile.objects.filter(user__username='foo').exists())
|
||||
|
||||
# there's no point in having a user without a cofprofile associated.
|
||||
u.save()
|
||||
Profile.objects.get(user__username='foo').delete()
|
||||
self.assertFalse(User.objects.filter(username='foo').exists())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue