def test_decoding_failure(self): self.form['SAMLRequest'] = 'XXX_not_base64_data_XXX' parser = HTTPPostRequestParser(self.form) with pytest.raises(RequestParserError) as excinfo: parser.parse() exc = excinfo.value self.assertEqual("Impossibile decodificare l'elemento 'SAMLRequest'", exc.args[0])
def test_missing_data(self): del self.form['SAMLRequest'] parser = HTTPPostRequestParser(self.form) with pytest.raises(RequestParserError) as excinfo: parser.parse() exc = excinfo.value self.assertEqual("Dato mancante nella request: 'SAMLRequest'", exc.args[0])
def test_relay_state_is_optional(self): del self.form['RelayState'] parser = HTTPPostRequestParser(self.form) parsed = parser.parse() self.assertIsNone(parsed.relay_state)
def test_valid_request(self): parser = HTTPPostRequestParser(self.form) parsed = parser.parse() self.assertEqual(parsed.saml_request, b'saml_request') self.assertEqual(parsed.relay_state, 'relay_state')