예제 #1
0
 def test_create_super_user(self):
     user_manager = UserManager()
     created_user = user_manager.create_superuser(
         username=self._username,
         personal_email=self._personal_email,
         company_email=self._company_email,
         phone=self._phone,
         job_title=self._job_title,
         first_name=self._first_name,
         last_name=self._last_name,
         password='******')
     self.assertEqual(created_user.__str__(), self._username)
     self.assertIsNotNone(created_user.password)
예제 #2
0
 def test_create_user(self):
     user_manager = UserManager()
     created_user = user_manager.create_user(
         username=self._username,
         personal_email=self._personal_email,
         company_email=self._company_email,
         phone=self._phone,
         job_title=self._job_title,
         first_name=self._first_name,
         last_name=self._last_name,
         password='******',
     )
     self.assertEqual(created_user.__str__(), self._username)
예제 #3
0
    def test_create_user_username_empty(self):
        user_manager = UserManager()
        with self.assertRaises(ValueError) as cm:
            user_manager.create_user(
                username='******',
                personal_email=self._personal_email,
                company_email=self._company_email,
                phone=self._phone,
                job_title=self._job_title,
                first_name=self._first_name,
                last_name=self._last_name,
                password='******',
            )

        the_exception = cm.exception
        self.assertEqual(the_exception.__class__, ValueError)
        self.assertEqual(str(the_exception), 'Username is required')
예제 #4
0
 def setUp(self):
     self.user_manager = UserManager()