1 | from django.test import TestCase
|
---|
2 | from django.contrib.auth import get_user_model
|
---|
3 |
|
---|
4 |
|
---|
5 | User = get_user_model()
|
---|
6 |
|
---|
7 | class DemoTest(TestCase):
|
---|
8 | fixtures = ['app1fixture', 'auth', 'app2fixture', 'app3fixture']
|
---|
9 |
|
---|
10 | def test_demo(self):
|
---|
11 | u = User.objects.create(username='Apple')
|
---|
12 | self.assertEqual(u.username, 'Apple')
|
---|
13 |
|
---|
14 | class DemoTest2(TestCase):
|
---|
15 | fixtures = ['app1fixture', 'auth', 'app2fixture', 'app3fixture']
|
---|
16 |
|
---|
17 | def test_demo2(self):
|
---|
18 | u = User.objects.create(username='Banana')
|
---|
19 | self.assertEqual(u.username, 'Banana')
|
---|
20 | self.assertEqual(u.username, 'Banana')
|
---|