Skip to content

Commit 573948c

Browse files
Added more tests
1 parent c567b41 commit 573948c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

tests/test_models.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,3 +584,13 @@ def test_application_clean(oauth2_settings, application):
584584
with pytest.raises(ValidationError) as exc:
585585
application.clean()
586586
assert "You cannot use HS256" in str(exc.value)
587+
588+
application.authorization_grant_type = Application.GRANT_AUTHORIZATION_CODE
589+
590+
# allowed_origins can be only https://
591+
application.allowed_origins = "http://example.com"
592+
with pytest.raises(ValidationError) as exc:
593+
application.clean()
594+
assert "Enter a valid URL" in str(exc.value)
595+
application.allowed_origins = "https://example.com"
596+
application.clean()

tests/test_token_endpoint_cors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def test_origin_not_from_allowed_origins(self):
122122
}
123123

124124
auth_headers = get_basic_auth_header(self.application.client_id, CLEARTEXT_SECRET)
125-
auth_headers["HTTP_ORIGIN"] = "another_example.org"
125+
auth_headers["HTTP_ORIGIN"] = "https://another_example.org"
126126
response = self.client.post(reverse("oauth2_provider:token"), data=token_request_data, **auth_headers)
127127
self.assertEqual(response.status_code, 200)
128128
self.assertFalse(response.has_header("Access-Control-Allow-Origin"))

0 commit comments

Comments
 (0)