Skip to content

Commit 37fe08c

Browse files
akanstantsinaudopry
authored andcommitted
Code review: update docs and test names
1 parent e89247e commit 37fe08c

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

docs/advanced_topics.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ logo, acceptance of some user agreement and so on.
2121
* :attr:`user` ref to a Django user
2222
* :attr:`redirect_uris` The list of allowed redirect uri. The string consists of valid URLs separated by space
2323
* :attr:`post_logout_redirect_uris` The list of allowed redirect uris after an RP initiated logout. The string consists of valid URLs separated by space
24+
* :attr:`allowed_origins` The list of origin URIs to enable CORS for token endpoint. The string consists of valid URLs separated by space
2425
* :attr:`client_type` Client type as described in :rfc:`2.1`
2526
* :attr:`authorization_grant_type` Authorization flows available to the Application
2627
* :attr:`client_secret` Confidential secret issued to the client during the registration process as described in :rfc:`2.2`

tests/test_cors.py renamed to tests/test_token_endpoint_cors.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
@pytest.mark.usefixtures("oauth2_settings")
2727
@pytest.mark.oauth2_settings(presets.DEFAULT_SCOPES_RW)
28-
class TestCors(TestCase):
28+
class TestTokenEndpointCors(TestCase):
2929
"""
3030
Test that CORS headers can be managed by OAuthLib.
3131
The objective is: http request 'Origin' header should be passed to OAuthLib
@@ -56,7 +56,7 @@ def tearDown(self):
5656
self.test_user.delete()
5757
self.dev_user.delete()
5858

59-
def test_cors_header(self):
59+
def test_valid_origin_with_https(self):
6060
"""
6161
Test that /token endpoint has Access-Control-Allow-Origin
6262
"""
@@ -87,7 +87,7 @@ def test_cors_header(self):
8787
self.assertEqual(response.status_code, 200)
8888
self.assertEqual(response["Access-Control-Allow-Origin"], CLIENT_URI)
8989

90-
def test_cors_header_no_https(self):
90+
def test_valid_origin_no_https(self):
9191
"""
9292
Test that CORS is not allowed if origin uri does not have https:// schema
9393
"""
@@ -107,7 +107,7 @@ def test_cors_header_no_https(self):
107107
self.assertEqual(response.status_code, 200)
108108
self.assertFalse(response.has_header("Access-Control-Allow-Origin"))
109109

110-
def test_no_cors_header_origin_not_allowed(self):
110+
def test_origin_not_from_allowed_origins(self):
111111
"""
112112
Test that /token endpoint does not have Access-Control-Allow-Origin
113113
when request origin is not in Application.allowed_origins
@@ -127,7 +127,7 @@ def test_no_cors_header_origin_not_allowed(self):
127127
self.assertEqual(response.status_code, 200)
128128
self.assertFalse(response.has_header("Access-Control-Allow-Origin"))
129129

130-
def test_no_cors_header_no_origin(self):
130+
def test_no_origin(self):
131131
"""
132132
Test that /token endpoint does not have Access-Control-Allow-Origin
133133
"""

0 commit comments

Comments
 (0)