diff --git a/lib/main/tests/__init__.py b/lib/main/tests/__init__.py index 5fcb4d327b..05f7c2d9aa 100644 --- a/lib/main/tests/__init__.py +++ b/lib/main/tests/__init__.py @@ -1,3 +1,4 @@ from lib.main.tests.organizations import OrganizationsTest +from lib.main.tests.users import UsersTest diff --git a/lib/main/tests/base.py b/lib/main/tests/base.py index 0e76f5d138..0bd988c81e 100644 --- a/lib/main/tests/base.py +++ b/lib/main/tests/base.py @@ -47,7 +47,7 @@ class BaseTest(django.test.TestCase): self.assertEquals(data['previous'], previous) self.assertEquals(data['next'], next) - def setup_users(self): + def setup_users(self, just_super_user=False): # Create a user. self.super_username = 'admin' self.super_password = 'admin' @@ -57,8 +57,11 @@ class BaseTest(django.test.TestCase): self.other_password = 'other' self.super_django_user = self.make_user(self.super_username, self.super_password, super_user=True) - self.normal_django_user = self.make_user(self.normal_username, self.normal_password, super_user=False) - self.other_django_user = self.make_user(self.other_username, self.other_password, super_user=False) + + if not just_super_user: + + self.normal_django_user = self.make_user(self.normal_username, self.normal_password, super_user=False) + self.other_django_user = self.make_user(self.other_username, self.other_password, super_user=False) def get_super_credentials(self): return (self.super_username, self.super_password) diff --git a/lib/main/tests/users.py b/lib/main/tests/users.py new file mode 100644 index 0000000000..58604bb871 --- /dev/null +++ b/lib/main/tests/users.py @@ -0,0 +1,71 @@ +""" +Test code for ansible commander. + +(C) 2013 AnsibleWorks +""" + + +import datetime +import json + +from django.contrib.auth.models import User as DjangoUser +import django.test +from django.test.client import Client +from lib.main.models import * +from lib.main.tests.base import BaseTest + +class UsersTest(BaseTest): + + def collection(self): + return '/api/v1/users/' + + def setUp(self): + #self.object_ctr = 0 + self.setup_users(just_super_user=True) + + def test_only_super_user_can_add_users(self): + self.assertTrue(False) + pass + + def test_normal_user_can_modify_some_fields_about_himself_but_not_all(self): + self.assertTrue(False) + pass + + def test_normal_user_cannot_modify_another_user(self): + self.assertTrue(False) + pass + + def test_superuser_can_modify_anything_about_anyone(self): + self.assertTrue(False) + pass + + def test_password_not_shown_in_get_operations(self): + self.assertTrue(False) + pass + + def test_created_user_can_login(self): + self.assertTrue(False) + pass + + def test_user_list_filtered_for_non_admin_users(self): + self.assertTrue(False) + pass + + def test_user_list_non_filtered_for_admin_users(self): + self.assertTrue(False) + pass + + def test_super_user_can_delete_a_user_but_only_marked_inactive(self): + self.assertTrue(False) + pass + + def test_non_super_user_cannot_delete_any_user_including_himself(self): + self.assertTrue(False) + pass + + def test_there_exists_an_obvious_url_where_a_user_may_find_his_user_record(self): + self.assertTrue(False) + pass + + +