def test_code_verifier_and_code_challenge_are_correct(self): import hashlib import base64 auth = SpotifyPKCE("CLID", "REDIR") auth.get_pkce_handshake_parameters() self.assertEqual( auth.code_challenge, base64.urlsafe_b64encode( hashlib.sha256(auth.code_verifier.encode( 'utf-8')).digest()).decode('utf-8').replace('=', ''))
def test_generate_code_challenge_for_pkce(self): auth = SpotifyPKCE("CLID", "REDIR") auth.get_pkce_handshake_parameters() self.assertTrue(auth.code_challenge)