-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #109 from italia/dev
v0.4.6 * fix: dependency installation * Code Coverage * feat: added python 3.10 in CI * chore: entity statement and trust mark content type, onboarding tools html …
- Loading branch information
Showing
24 changed files
with
239 additions
and
63 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.4.5" | ||
__version__ = "0.4.6" |
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 |
---|---|---|
|
@@ -2,7 +2,12 @@ | |
|
||
from django.test import TestCase | ||
from spid_cie_oidc.authority.settings import FEDERATION_DEFAULT_POLICY | ||
from spid_cie_oidc.entity.policy import apply_policy, gather_policies | ||
from spid_cie_oidc.entity.policy import ( | ||
PolicyError, | ||
apply_policy, | ||
combine_claim_policy, diff2policy, | ||
gather_policies | ||
) | ||
from spid_cie_oidc.entity.tests.rp_metadata_settings import RP_METADATA | ||
|
||
|
||
|
@@ -24,3 +29,66 @@ def test_apply_policy(self): | |
combined_contacts = combined_policy["contacts"] | ||
self.assertTrue("[email protected]" in combined_contacts) | ||
self.assertTrue("[email protected]" in combined_contacts) | ||
|
||
def test_diff_two_policy(self): | ||
fa_policy_old = {} | ||
fa_policy_old["scopes"] = FEDERATION_DEFAULT_POLICY["openid_relying_party"][ | ||
"scopes" | ||
] | ||
fa_policy_new = deepcopy(fa_policy_old) | ||
fa_policy_new["contacts"] = {"add": "[email protected]"} | ||
result = diff2policy(fa_policy_new, fa_policy_old) | ||
diff = { | ||
"contacts": { | ||
"add": { | ||
"add": "[email protected]" | ||
} | ||
} | ||
} | ||
self.assertTrue(result == diff) | ||
|
||
def test_combine_claim_policy(self): | ||
superior = {} | ||
child = {} | ||
combined = combine_claim_policy(superior, child) | ||
self.assertEquals(combined, {}) | ||
superior = {"value" : "val"} | ||
child = {"essential": False} | ||
combined = combine_claim_policy(superior, child) | ||
self.assertEquals(combined, {"value": "val", "essential": False}) | ||
child = {"essential": "ess", "add" : "added"} | ||
with self.assertRaises(PolicyError): | ||
combine_claim_policy(superior, child) | ||
child = {"value": "valChild", "add" : "added"} | ||
with self.assertRaises(PolicyError): | ||
combine_claim_policy(superior, child) | ||
child = {"value": "val", "add" : "added"} | ||
combined = combine_claim_policy(superior, child) | ||
self.assertEquals(combined, superior) | ||
child = {"add" : "added"} | ||
with self.assertRaises(PolicyError): | ||
combine_claim_policy(superior, child) | ||
child = {} | ||
combined = combine_claim_policy(superior, child) | ||
self.assertEquals(combined, superior) | ||
superior = {"essential": True} | ||
child = {"essential": False} | ||
with self.assertRaises(PolicyError): | ||
combine_claim_policy(superior, child) | ||
child = {"essential": True, "one_of" : True, "subset_of": []} | ||
with self.assertRaises(PolicyError): | ||
combine_claim_policy(superior, child) | ||
superior = { "superset_of": []} | ||
child = { "subset_of": []} | ||
combined = combine_claim_policy(superior, child) | ||
self.assertEquals(combined, {'superset_of': [], 'subset_of': []}) | ||
child = { "subset_of": [], "default" : ""} | ||
combined = combine_claim_policy(superior, child) | ||
self.assertEquals(combined, {'subset_of': [], 'superset_of': [], 'default': ''}) | ||
child = { "default" : ""} | ||
combined = combine_claim_policy(superior, child) | ||
self.assertEquals(combined, {'superset_of': [], 'default': ''}) | ||
superior = { "subset_of": []} | ||
combined = combine_claim_policy(superior, child) | ||
self.assertEquals(combined, {'subset_of': [], 'default': ''}) | ||
|
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,29 @@ | ||
from django.test import TestCase | ||
from spid_cie_oidc.authority.tests.settings import ( | ||
RP_METADATA_JWK1, | ||
RP_METADATA_JWK1_pub | ||
) | ||
from spid_cie_oidc.entity.validators import ( | ||
validate_private_jwks, | ||
validate_public_jwks | ||
) | ||
|
||
|
||
class ValidatrTest(TestCase): | ||
|
||
def setUp(self): | ||
pass | ||
|
||
def test_validate_public_jwks_with_private_key(self): | ||
with self.assertRaises(Exception): | ||
validate_public_jwks(RP_METADATA_JWK1) | ||
|
||
def test_validate_private_jwks_with_public_key(self): | ||
with self.assertRaises(Exception): | ||
validate_private_jwks(RP_METADATA_JWK1_pub) | ||
|
||
def test_validate_public_jwks(self): | ||
validate_public_jwks(RP_METADATA_JWK1_pub) | ||
|
||
def test_validate_private_jwks(self): | ||
validate_private_jwks(RP_METADATA_JWK1) |
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 |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
"token_endpoint": "http://op-test/oidc/op/token/", | ||
"userinfo_endpoint": "http://op-test/oidc/op/userinfo/", | ||
"introspection_endpoint": "http://op-test/oidc/op/introspection/", | ||
"revocation_endpoint": "http://op-test/oidc/op/revocation/", | ||
"claims_parameter_supported": True, | ||
"contacts": ["[email protected]"], | ||
"client_registration_types_supported": ["automatic"], | ||
|
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
Oops, something went wrong.