Skip to content

Commit

Permalink
Fix test regression in oauthlib 2.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jleclanche committed Sep 15, 2017
1 parent ed96137 commit 47dd70f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ include_package_data = True
zip_safe = False
install_requires =
django >= 1.10
oauthlib >= 2.0.1
oauthlib >= 2.0.3
requests >= 2.13.0

[options.packages.find]
Expand Down
11 changes: 9 additions & 2 deletions tests/test_authorization_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from django.test import RequestFactory, TestCase
from django.urls import reverse
from django.utils import timezone
from oauthlib.oauth2.rfc6749 import errors as oauthlib_errors

from oauth2_provider.compat import parse_qs, urlencode, urlparse
from oauth2_provider.models import (
Expand Down Expand Up @@ -883,7 +884,10 @@ def test_malicious_redirect_uri(self):
}

response = self.client.post(reverse("oauth2_provider:token"), data=token_request_data)
self.assertEqual(response.status_code, 401)
self.assertEqual(response.status_code, 400)
data = response.json()
self.assertEqual(data["error"], "invalid_request")
self.assertEqual(data["error_description"], oauthlib_errors.MismatchingRedirectURIError.description)

def test_code_exchange_succeed_when_redirect_uri_match(self):
"""
Expand Down Expand Up @@ -948,7 +952,10 @@ def test_code_exchange_fails_when_redirect_uri_does_not_match(self):
auth_headers = get_basic_auth_header(self.application.client_id, self.application.client_secret)

response = self.client.post(reverse("oauth2_provider:token"), data=token_request_data, **auth_headers)
self.assertEqual(response.status_code, 401)
self.assertEqual(response.status_code, 400)
data = response.json()
self.assertEqual(data["error"], "invalid_request")
self.assertEqual(data["error_description"], oauthlib_errors.MismatchingRedirectURIError.description)

def test_code_exchange_succeed_when_redirect_uri_match_with_multiple_query_params(self):
"""
Expand Down

0 comments on commit 47dd70f

Please sign in to comment.