Skip to content

Commit

Permalink
fix: VAT and FC, public and private profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
peppelinux committed Jun 7, 2021
1 parent 216a695 commit b179e2d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def readme():

setup(
name='spid_sp_test',
version='0.6.3',
version='0.6.4',
description="SAML2 SPID Service Provider validation tool that can be run from the command line",
long_description=readme(),
long_description_content_type='text/markdown',
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 @@ -666,7 +666,7 @@ def test_profile_spid_sp_private(self):
# email_xpath="//ContactPerson/Extensions/CessionarioCommittente/EmailAddress"
# )

self.test_Contacts_VATFC()
self.test_Contacts_VATFC(private=True)
self.test_Contacts_Priv()
self.xsd_check(xsds_files = [
'saml-schema-metadata-2.0.xsd',
Expand Down
10 changes: 8 additions & 2 deletions src/spid_sp_test/metadata_public.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,12 @@ def test_extensions_public_private(self, ext_type="Public"):
)
return self.is_ok(f'{self.__class__.__name__}.test_extentions_public')

def test_Contacts_VATFC(self):
def test_Contacts_VATFC(self, private=False):
entity_desc = self.doc.xpath('//ContactPerson')

vat = self.doc.xpath('//ContactPerson/Extensions/VATNumber')
self._assertTrue(
(len(vat) == 1),
(len(vat) <= 1),
'only one VATNumber element must be present',
description = vat
)
Expand All @@ -194,4 +194,10 @@ def test_Contacts_VATFC(self):
'The FiscalCode element MUST have a value',
)

if private and not fc and not vat:
self._assertTrue(
False,
'If the VATNumber is not present, the FiscalCode element MUST be present',
)

return self.is_ok(f'{self.__class__.__name__}.test_Contacts_VATFC')

0 comments on commit b179e2d

Please sign in to comment.