예제 #1
0
    def test_get_current_employee(self, mock_get_current_user):
        employee = create_employee(username='******')
        mock_get_current_user.return_value = employee.user
        current_employee = Employee.get_current_employee()

        self.assertIsNotNone(current_employee)
        self.assertEqual('john.d', current_employee.username)
예제 #2
0
    def test_get_current_employee_raises(self, mock_get_current_user):
        mock_get_current_user.return_value = users.User('*****@*****.**')

        with self.assertRaises(NoSuchEmployee):
            Employee.get_current_employee()