Beispiel #1
0
    def setUp(self):
        # create dept and admin user
        self.department = DepartmentFactory()
        self.admin_user = UserFactory()
        DepartmentAdministratorFactory(profile=self.admin_user.profile,
                                       department=self.department)

        # let's add some account/profiles
        self.account1 = AccountFactory(department=self.department)
        self.u1 = UserFactory()
Beispiel #2
0
    def setUp(self):
        self.test_user = UserFactory()
        self.assertTrue(
            UserProfile.objects.filter(user_id=self.test_user.id).exists())
        department = DepartmentFactory()
        self.user_profile = UserProfile.objects.filter(
            user_id=self.test_user.id).update(
                address=' test address',
                postcode='test postcode',
                city='test city',
                sex=UserProfile.FEMALE,
                tel='test tel',
            )
        AccountFactory.create(department=department,
                              user_profiles=[self.user_profile])
        self.test_user.set_password('pass')
        self.test_user.save()
        email_address = EmailAddress.objects\
            .add_email(None, self.test_user, '*****@*****.**', confirm=False,
                       signup=False)
        email_address.verified = True
        email_address.primary = True
        email_address.save()

        self.client.login(username=self.test_user.username, password='******')
Beispiel #3
0
 def setUp(self):
     self.user = UserFactory()
     self.user.set_password('pass')
     self.user.save()
     email_address = EmailAddress.objects\
         .add_email(None, self.user, '*****@*****.**', confirm=False,
                    signup=False)
     email_address.verified = True
     email_address.primary = True
     email_address.save()
Beispiel #4
0
    def setUp(self):
        self.user = UserFactory(email='*****@*****.**')
        self.user.set_password('pass')
        self.user.is_superuser = True

        self.department = DepartmentFactory()
        self.account_category = AccountCategoryFactory()

        content_type = ContentType.objects.get_for_model(DepartmentInvitation)
        can_invite = Permission.objects.get(content_type=content_type,
                                            codename='can_invite')
        self.user.user_permissions.add(can_invite)
        self.user.save()
        os.environ['RECAPTCHA_TESTING'] = 'True'
Beispiel #5
0
    def test_user_member_department_models(self):
        # Although this may look like testing ORM API I thought it
        # would be good to just write a test to show how we expect
        # membership to work
        department = DepartmentFactory()
        user2 = UserFactory()
        user2.profile.save()
        account = AccountFactory(department=department)
        account.user_profiles.add(user2.profile)
        account.user_profiles.add(self.user.profile)
        self.assertEqual(2, account.user_profiles.all().count())

        # we don't have to have a fresh copy of dept
        self.assertEqual(1, department.accounts.count())
        department.accounts.all().delete()
        self.assertEqual(0, department.accounts.count())