Ejemplo n.º 1
0
 def test_failed_check_password_hash(self, mock_request,
                                     mock_find_by_username,
                                     mock_check_password_hash):
     mock_request.authorization = self.Authorization()
     with self.assertRaises(Unauthorized):
         auth()
def authenticate():
    return helper.auth()
Ejemplo n.º 3
0
 def test_none_find_by_username(self, mock_request, mock_find_by_username):
     mock_request.authorization = self.Authorization()
     with self.assertRaises(NotFound):
         auth()
Ejemplo n.º 4
0
 def test_without_authorization_password(self, mock_request):
     mock_request.authorization = self.Authorization()
     mock_request.authorization.password = None
     with self.assertRaises(Unauthorized):
         auth()
Ejemplo n.º 5
0
 def test_without_authorization_username(self, mock_request):
     mock_request.authorization = self.Authorization()
     mock_request.authorization.username = None
     with self.assertRaises(Unauthorized):
         auth()
Ejemplo n.º 6
0
 def test_without_authorization(self, mock_request):
     mock_request.authorization = None
     with self.assertRaises(Unauthorized):
         auth()
Ejemplo n.º 7
0
 def test_success(self, mock_request, mock_find_by_username,
                  mock_check_password_hash):
     mock_request.authorization = self.Authorization()
     response = auth()
     assert self.success_schema.validate(response)