italia/spid-sp-test

Unit test and code coverage

peppelinux opened this issue · 3 comments

At this moment we have a naif integration test suite based on system command and example metadata.

https://github.com/italia/spid-sp-test/blob/main/tests/test_02_authn.py

We need instead a metadata/authnrequest templating system (as already done fo saml2 responses) and a huge number of unit test that checks spid-sp-test case-by-case, simulating some common scenario and exceptions

Here an example about how we could implement the unit tests
f30be8c

as we can see we just need a metadata string (faulty or not!).
Once the metadata was loaded we can call the method that we want to test

Here an example abou how to add a unit test for the spid-sp-test metadata checks
esempio_unittest_metadata_spid-sp-test

Here a good start point for testing authn requests
https://github.com/italia/spid-sp-test/blob/main/tests/test_06_authnrequest.py

coverage up to 84% (even if integration test cover more ... but can't be covered in the report!)
https://github.com/italia/spid-sp-test/runs/3807703820#step:7:73