Skip to content

Commit 3b85e70

Browse files
committed
SDK-1615: Support accept self asserted keyword argument
1 parent 0f47ea1 commit 3b85e70

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

yoti_python_sdk/dynamic_sharing_service/policy/dynamic_policy_builder.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ def __attribute_keyword_parser(self, attributeBuilder, **kwargs):
3838
if constraints:
3939
attributeBuilder.with_constraint(constraints)
4040

41+
accept_self_asserted = kwargs.get("accept_self_asserted", None)
42+
if accept_self_asserted is not None:
43+
attributeBuilder.with_accept_self_asserted(accept_self_asserted)
44+
4145
def with_wanted_attribute_by_name(self, wanted_name, **kwargs):
4246
"""
4347
@param wanted_name The name of the attribute to include

yoti_python_sdk/tests/dynamic_sharing_service/policy/test_dynamic_policy_builder.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,18 @@ def test_attributes_with_constraints():
130130
constraint = SourceConstraintBuilder().with_national_id().build()
131131
policy = DynamicPolicyBuilder().with_nationality(constraints=constraint).build()
132132
assert len(policy["wanted"][0]["constraints"]) == 1
133+
134+
135+
def test_attributes_with_accept_self_asserted_true():
136+
policy = DynamicPolicyBuilder().with_nationality(accept_self_asserted=True).build()
137+
assert policy["wanted"][0]["accept_self_asserted"] is True
138+
139+
140+
def test_attributes_with_accept_self_asserted_false():
141+
policy = DynamicPolicyBuilder().with_nationality(accept_self_asserted=False).build()
142+
assert policy["wanted"][0]["accept_self_asserted"] is False
143+
144+
145+
def test_attributes_without_accept_self_asserted():
146+
policy = DynamicPolicyBuilder().with_nationality().build()
147+
assert not hasattr(policy["wanted"][0], "accept_self_asserted")

0 commit comments

Comments
 (0)