kopia lustrzana https://github.com/OpenDroneMap/WebODM
Merge pull request #12 from vesnikos/unittests-fixtures
added fixtures for tests, updated tests to use fixturespull/17/head
commit
ed20832a6a
|
@ -0,0 +1,12 @@
|
|||
- model: app.project
|
||||
pk: 1
|
||||
fields: {owner: 2, name: Test_Project2, description: This is a test project, created_at: ! '2016-09-12
|
||||
10:08:39.045372+00:00'}
|
||||
- model: app.project
|
||||
pk: 2
|
||||
fields: {owner: 1, name: Test_Project1, description: This is a test project, created_at: ! '2016-09-12
|
||||
10:08:58.533742+00:00'}
|
||||
- model: app.project
|
||||
pk: 3
|
||||
fields: {owner: 1, name: Test_Project3, description: This is a test project, created_at: ! '2016-09-12
|
||||
10:11:31.357885+00:00'}
|
|
@ -0,0 +1,32 @@
|
|||
- model: auth.user
|
||||
pk: 1
|
||||
fields:
|
||||
# password: test1234
|
||||
password: pbkdf2_sha256$30000$pFwIz88hEEZ4$siNaZefZB3bb0DlemWNOkj6+tCq3I3LW+IgVw5VsRmE=
|
||||
last_login: null
|
||||
is_superuser: true
|
||||
username: testuser
|
||||
first_name: ''
|
||||
last_name: ''
|
||||
email: test@mail.com
|
||||
is_staff: true
|
||||
is_active: true
|
||||
date_joined: 2016-09-11 22:26:52.582858+00:00
|
||||
groups: []
|
||||
user_permissions: []
|
||||
- model: auth.user
|
||||
pk: 2
|
||||
fields:
|
||||
# password: test1234
|
||||
password: pbkdf2_sha256$30000$pFwIz88hEEZ4$siNaZefZB3bb0DlemWNOkj6+tCq3I3LW+IgVw5VsRmE=
|
||||
last_login: null
|
||||
is_superuser: true
|
||||
username: testuser2
|
||||
first_name: ''
|
||||
last_name: ''
|
||||
email: test2@mail.com
|
||||
is_staff: true
|
||||
is_active: true
|
||||
date_joined: 2016-09-11 22:26:52.582858+00:00
|
||||
groups: []
|
||||
user_permissions: []
|
17
app/tests.py
17
app/tests.py
|
@ -3,24 +3,25 @@ from django.test import TestCase
|
|||
from django.contrib.auth.models import User, Group
|
||||
from django.test import Client
|
||||
|
||||
from .models import Project,Task
|
||||
|
||||
# Create your tests here.
|
||||
|
||||
class TestUser(TestCase):
|
||||
|
||||
fixtures = ['test_users', ]
|
||||
|
||||
def setUp(self):
|
||||
self.credentials = {
|
||||
'username': 'testuser',
|
||||
'password': 'secret',
|
||||
'password': 'test1234',
|
||||
'email': 'test@mail.com'}
|
||||
self.u = User.objects.create_user(
|
||||
username=self.credentials['username'],
|
||||
email=self.credentials['email'],
|
||||
password=self.credentials['password'],
|
||||
is_superuser=True
|
||||
|
||||
)
|
||||
# Create a test Group
|
||||
my_group, created = Group.objects.get_or_create(name='test_group')
|
||||
self.u.groups.add(my_group)
|
||||
|
||||
# Add user to test Group
|
||||
User.objects.get(pk=1).groups.add(my_group)
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
|
Ładowanie…
Reference in New Issue