Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 4, 2023
1 parent 5160417 commit 34630d8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
4 changes: 1 addition & 3 deletions social_core/backends/checkin.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ def get_user_details(self, response):

def entitlement_allowed(self, user_entitlements):
allowed = True
allowed_ent = self.setting(
"ALLOWED_ENTITLEMENTS", self.ALLOWED_ENTITLEMENTS
)
allowed_ent = self.setting("ALLOWED_ENTITLEMENTS", self.ALLOWED_ENTITLEMENTS)
if allowed_ent:
allowed = any(e in user_entitlements for e in allowed_ent)
return allowed
Expand Down
18 changes: 11 additions & 7 deletions social_core/tests/backends/test_checkin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from .oauth import OAuth2Test
from .test_open_id_connect import OpenIdConnectTestMixin


class CheckinOpenIdConnectTest(OpenIdConnectTestMixin, OAuth2Test):
backend_path = "social_core.backends.checkin.CheckinOpenIdConnect"
issuer = "https://aai.egi.eu/auth/realms/egi"
Expand Down Expand Up @@ -298,18 +299,21 @@ class CheckinOpenIdConnectTest(OpenIdConnectTestMixin, OAuth2Test):
)

def test_checkin_env_prod(self):
self.assertEqual(self.backend.oidc_endpoint(),
"https://aai.egi.eu/auth/realms/egi")
self.assertEqual(
self.backend.oidc_endpoint(), "https://aai.egi.eu/auth/realms/egi"
)

def test_checkin_env_demo(self):
self.backend.CHECKIN_ENV = "demo"
self.assertEqual(self.backend.oidc_endpoint(),
"https://aai-demo.egi.eu/auth/realms/egi")

self.assertEqual(
self.backend.oidc_endpoint(), "https://aai-demo.egi.eu/auth/realms/egi"
)

def test_checkin_env_dev(self):
self.backend.CHECKIN_ENV = "dev"
self.assertEqual(self.backend.oidc_endpoint(),
"https://aai-dev.egi.eu/auth/realms/egi")
self.assertEqual(
self.backend.oidc_endpoint(), "https://aai-dev.egi.eu/auth/realms/egi"
)

def test_entitlements_empty(self):
self.assertEqual(self.backend.entitlement_allowed([]), True)
Expand Down

0 comments on commit 34630d8

Please sign in to comment.