diff --git a/app/fixtures/test_project.yaml b/app/fixtures/test_project.yaml new file mode 100644 index 00000000..b40b3d49 --- /dev/null +++ b/app/fixtures/test_project.yaml @@ -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'} \ No newline at end of file diff --git a/app/fixtures/test_users.yaml b/app/fixtures/test_users.yaml new file mode 100644 index 00000000..a66b302e --- /dev/null +++ b/app/fixtures/test_users.yaml @@ -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: [] \ No newline at end of file diff --git a/app/tests.py b/app/tests.py index 39be5fb3..8698e224 100644 --- a/app/tests.py +++ b/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