Beispiel #1
0
 def test_set_verifier(self):
     self.assertEqual(self.token.verifier, None)
     v = oauth.generate_verifier()
     self.token.set_verifier(v)
     self.assertEqual(self.token.verifier, v)
     self.token.set_verifier()
     self.assertNotEqual(self.token.verifier, v)
     self.token.set_verifier('')
     self.assertEqual(self.token.verifier, '')
Beispiel #2
0
    def test_get_callback_url(self):
        self.assertEqual(self.token.get_callback_url(), None)

        self.token.set_verifier()
        self.assertEqual(self.token.get_callback_url(), None)

        cb = 'http://www.example.com/my-callback?save=1&return=true'
        v = oauth.generate_verifier()
        self.token.set_callback(cb)
        self.token.set_verifier(v)
        url = self.token.get_callback_url()
        verifier_str = '&oauth_verifier=%s' % v
        self.assertEqual(url, '%s%s' % (cb, verifier_str))

        cb = 'http://www.example.com/my-callback-no-query'
        v = oauth.generate_verifier()
        self.token.set_callback(cb)
        self.token.set_verifier(v)
        url = self.token.get_callback_url()
        verifier_str = '?oauth_verifier=%s' % v
        self.assertEqual(url, '%s%s' % (cb, verifier_str))
Beispiel #3
0
 def test_gen_verifier(self):
     verifier = oauth.generate_verifier()
     self.assertEqual(len(verifier), 8)
     verifier = oauth.generate_verifier(16)
     self.assertEqual(len(verifier), 16)