Skip to content

Commit

Permalink
Merge pull request #139 from italia/dev
Browse files Browse the repository at this point in the history
fix: [Responses] AttributeConsumingServiceIndex and AttributeConsumingServiceURL 87ec02f
added check for "__aggrsint" value
  • Loading branch information
Giuseppe De Marco authored Jul 5, 2022
2 parents ad6cab0 + 6a47869 commit e7ac164
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/spid_sp_test/authn_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def __init__(
self.request_content_type = request_content_type
self.xsds_files = xsds_files or self.xsds_files
self.xsds_files_path = xsds_files_path or f"{BASE_DIR}/xsd"

def load(self):
try:
self.authn_request = get_authn_request(
Expand Down
2 changes: 1 addition & 1 deletion src/spid_sp_test/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def test_KeyDescriptor(self):
)

kds = self.doc.xpath(
"//EntityDescriptor/SPSSODescriptor" '/KeyDescriptor[@use="encryption"]'
'//EntityDescriptor/SPSSODescriptor/KeyDescriptor[@use="encryption"]'
)
for kd in kds:
certs = kd.xpath(
Expand Down
44 changes: 37 additions & 7 deletions src/spid_sp_test/metadata_public.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ def test_Contacts_IPACode(
test_id=["01.11.03", "01.17.13"],
**_data,
)
self._assertTrue(
entity_type == "spid:aggregated",
("The IPACode __aggrsint could be used only for test metadata in the aggregated contact."),
level="error",
**_data,
)
res = get_indicepa_by_ipacode(ipacode.text)
self._assertTrue(
res[0] > 0,
Expand All @@ -231,7 +237,17 @@ def test_Contacts_IPACode(
test_id=["01.11.02", "01.18.03", "01.20.02"],
**_data,
)
if private:

elif public:
if ipacode[0].text == "__aggrsint":
self._assertFalse(
entity_type == "spid:aggregated",
("The IPACode __aggrsint should be used only for test metadata."),
level="warning",
**_data,
)

elif private:
self._assertTrue(
len(ipacode) == 0,
"The IPACode element MUST NOT be present",
Expand Down Expand Up @@ -311,12 +327,26 @@ def test_Contacts_VATFC(
test_id=["01.11.06", "01.17.16"],
**_data,
)
self._assertTrue(
(vats[0].text and vats[0].text[:2] in ISO3166_CODES),
"The VATNumber element MUST start with a valid ISO3166 Code",
test_id=["01.11.10", "01.17.17"],
**_data,
)
if vats[0].text == "__aggrsint":
self._assertFalse(
entity_type == "spid:aggregated",
("The VATNumber __aggrsint should be used only for test metadata."),
level="warning",
**_data,
)
self._assertTrue(
entity_type == "spid:aggregator",
("The VATNumber __aggrsint could be used only for test metadata in the aggregated contact."),
level="error",
**_data,
)
else:
self._assertTrue(
(vats[0].text and vats[0].text[:2] in ISO3166_CODES),
"The VATNumber element MUST start with a valid ISO3166 Code",
test_id=["01.11.10", "01.17.17"],
**_data,
)

fcs = self.doc.xpath(
f"{xpatt}/Extensions/FiscalCode", namespaces=XML_NAMESPACES
Expand Down

0 comments on commit e7ac164

Please sign in to comment.