def test_build_url(self): sso = SSO(app=self.app) url, state = sso.make_sso_url() redirect_url = urlencode({'redirect_uri': url_for(self.app.config['SSO']['redirect_url'], _external=True)}) self.assertIn('state=' + state, url) self.assertIn('client_id=barfoo', url) self.assertIn(redirect_url, url)
def test_make_authorization_header(self): sso = SSO(app=self.app) authorization = base64.b64decode(sso._make_basic_auth().split('Basic ')[1]).decode('utf-8') self.assertEqual(authorization, 'barfoo:foobar')