Improve policy coverage of tests
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- java
- Domain
- testing-qa
Research direction
Start by examining the existing PolicyHarnassTest and how policy, request, and response cases are currently assembled. Then assess the proposed policy.json, request.json, and tests.yaml fixture layout and template-engine requirements. Done means multiple templated cases can be loaded and their expected PDP decisions and attributes are checked consistently.
Written by the indexing model from the issue text.
Description
Add more policies to the tests.
I've bene tinkering around with the PolicyHarnassTest, but that's a little bit inconvenient to tests a large number of cases quickly, because it requires you to put in a policy, request and response for each usecase.
I would like to have a bit more advanced type of testing based on similar ideas as the HarnassTest.
I want to create a number of directories. Each of the dirs contains:
- a policy template
policy.json - a request template
request.json - test specifications
tests.yaml
The policy template is a (jinja-like, but can be any template engine that supports loops and stuff) policy skeleton that allows substitution of template vars (which are defined in the test specification).
For example (using jinja syntax):
{
"id": "abc",
"policyId": "urn:surfconext:xacml:policy:id:some_name",
"name": "some name",
"description": "Testing templae",
"serviceProviderIds": ["{{ policy_sps | join('", "') }}"],
"serviceProvidersNegated": false,
"identityProviderIds": [ "{{ policy_idp }}" ],
"attributes": [
{
"name": "urn:mace:dir:attribute-def:eduPersonAffiliation",
"value": "staff",
"negated": false,
"groupID": 0
}
],
"denyRule": {{ policy_is_deny | bool }},
"allAttributesMustMatch": false,
"created": "2025-11-25T09:33:28.216025782Z",
"denyAdvice": "NOT ALLOWED",
"denyAdviceNl": "MAG NIET",
"active": true,
"actionsAllowed": false,
"type": "reg",
"revisionNbr": 0,
"activatedSr": false
}
Here we use three template vars: policy_sps (list of strings)m policy_idp (string) and policy_is_deny (bool). These are specified in the tests specification (see below).
The XACML request is a similar template:
{
"Request": {
"AccessSubject": {
"Attribute": [
{%- for a in affiliation -%}
{ "AttributeId": "urn:mace:dir:attribute-def:eduPersonAffiliation", "Value": "{{ a }}" }
{% if not loop.last %},{% endif %}
{%- endfor -%}
]
},
"Resource": {
"Attribute": [
{
"AttributeId": "SPentityID",
"Value": "{{ sp }}"
},
{
"AttributeId": "IDPentityID",
"Value": "{{ idp }}"
},
{
"AttributeId": "ClientID",
"Value": "EngineBlock"
}
]
}
}
}
The test specification is a yaml file (could be json, is that's easier) in which the tests along with the template vars are defined. The file looks like this:
- One file can contain multiple tests.
- Each test contains a
varssection specifying global template vars for all subtests - Each test also contains a
testssection defifing the subtests to run - Each subtest has a
varssection defining addition template variables - Each subtest also has a
resultsection, that defines a Decision that is to be matched against the PDP Response - Each subtest can also have an
Attributesection that defines attributes that are matched against
For example:
test_two_sps:
vars:
policy_idp: "http://idp1"
policy_sp: ["http://sp1", "http://sp2"]
idp: "http//idp1"
tests:
- vars: { "policy_is_deny": false, "sp": "http://sp1", "affiliation": ["student"] }
result: { "Decision": "Permit" }
- vars: { "policy_is_deny": false, "sp": "http://sp1", "affiliation": ["staff"] }
result: { "Decision": "Deny", Attribute: {"DenyMessage:en": "NOT ALLOWED" }
- vars: { "policy_is_deny": false, "sp": "http://sp2", "affiliation": ["student"] }
result: { "Decision": "NotApplicable" }
- vars: { "policy_is_deny": true, "sp": "http://sp1", "affiliation": ["student"] }
result: { "Decision": "Deny", Attribute: {"DenyMessage:en": "NOT ALLOWED" }
- vars: { "policy_is_deny": true, "sp": "http://sp1", "affiliation": ["staff"] }
result: { "Decision": "Permit" }
- vars: { "policy_is_deny": true, "sp": "http://sp2", "affiliation": ["student"] }
result: { "Decision": "NotApplicable" }
test_one_sp:
vars:
policy_idp: "http://idp1"
policy_sp: ["http://sp1"]
idp: "http//idp1"
tests:
- vars: { "policy_is_deny": false, "sp": "http://sp1", "affiliation": ["student"] }
result: { "Decision": "Permit" }
- vars: { "policy_is_deny": false, "sp": "http://sp1", "affiliation": ["staff"] }
result: { "Decision": "Deny", Attribute: {"DenyMessage:en": "NOT ALLOWED" }
- vars: { "policy_is_deny": false, "sp": "http://sp2", "affiliation": ["student"] }
result: { "Decision": "NotApplicable" }
- vars: { "policy_is_deny": true, "sp": "http://sp1", "affiliation": ["student"] }
result: { "Decision": "Deny", Attribute: {"DenyMessage:en": "NOT ALLOWED" }
- vars: { "policy_is_deny": true, "sp": "http://sp1", "affiliation": ["staff"] }
result: { "Decision": "Permit" }
- vars: { "policy_is_deny": true, "sp": "http://sp2", "affiliation": ["student"] }
- Dominant language
- Java
- Stars
- 9
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OpenConext/OpenConext-pdp
-
Needs refinement
Difficulty 5/5 Over a week Newbie friendliness 25/100
OpenConext/OpenConext-pdp#303 · 1 comment ·
-
case sensitivity of email address matchingMay be free again @baszoetekouw claimed this 142 days ago, and no pull request is open. OpenNeeds refinement
OpenConext/OpenConext-pdp#291 · 1 assignee ·
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
OpenConext/OpenConext-pdp#290 ·
-
Use application-specific useragent string for outgoing http requestsMay be free again @oharsta claimed this 80 days ago, and no pull request is open. Open
OpenConext/OpenConext-pdp#289 · 1 assignee ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
OpenConext/OpenConext-pdp#287 ·
All issues in OpenConext/OpenConext-pdp
Similar issues
-
0. Needs triage enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
davidfercas/opendcanard#34 ·
-
good first issue help wanted
Difficulty 1/5 Under an hour Newbie friendliness 90/100
erkamyaman/rust-anything#702 ·
Maintainers usually reply within 1 day
-
beginner build dependencies difficulty: easy good first issue hacktoberfest help wanted size/S testing up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 94/100
-
Update CHANGELOG.mdOpen
Difficulty 1/5 Under an hour Newbie friendliness 84/100
OpenConext/OpenConext-oidcng#373 ·