def test07(self): '''Check reference counting''' s = lasso.Samlp2AuthnRequest() cptr = s._cptr a = sys.getrefcount(s._cptr) del (s) b = sys.getrefcount(cptr) self.failUnlessEqual(b, a - 1)
def test_sp_initiated_login_requested_authn_context(private_settings, client): private_settings.MELLON_IDENTITY_PROVIDERS = [{ 'METADATA': open('tests/metadata.xml').read(), 'AUTHN_CLASSREF': [ u'urn:be:fedict:iam:fas:citizen:eid', u'urn:be:fedict:iam:fas:citizen:token' ], }] response = client.get('/login/') assert response.status_code == 302 params = parse_qs(urlparse(response['Location']).query) assert response['Location'].startswith('http://idp5/singleSignOn?') assert params.keys() == ['SAMLRequest'] assert len(params['SAMLRequest']) == 1 assert base64.b64decode(params['SAMLRequest'][0]) request = lasso.Samlp2AuthnRequest() assert request.initFromQuery(urlparse(response['Location']).query) assert request.requestedAuthnContext.authnContextClassRef == ( 'urn:be:fedict:iam:fas:citizen:eid', 'urn:be:fedict:iam:fas:citizen:token')