-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fiddle with unit tests, fix redirects for webapp oauth app to include…
… all hostnames from ALLOWED_HOSTS
- Loading branch information
Showing
6 changed files
with
45 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"""Tests for the users app.""" | ||
|
||
from django.conf import settings | ||
from oauth2_provider.models import get_application_model | ||
|
||
from utils.tests import BmaTestBase | ||
|
||
Application = get_application_model() | ||
|
||
|
||
class TestUserOauthApplication(BmaTestBase): | ||
"""Tests for oauth stuff.""" | ||
|
||
def test_user_oauth_app_for_webapp(self) -> None: | ||
"""Make sure the webapp oauth app has been created correctly for all users.""" | ||
redirect_uris = [f"https://{hostname}/api/csrf/" for hostname in settings.ALLOWED_HOSTS] | ||
for user in self.users: | ||
app = Application.objects.get(name="autocreated-bma-webapp-client", user=user) | ||
assert app.redirect_uris == " ".join(redirect_uris) | ||
assert app.client_type == "public" | ||
assert app.authorization_grant_type == "authorization-code" | ||
assert app.skip_authorization | ||
assert hasattr(self.user0, "webapp_oauth_client_id") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters