Ejemplo n.º 1
0
    def authorize_request_token(self, request, oauth_request, request_token,
                                session=None):
        request_token.is_approved = True
        request_token.user = request.user
        request_token.verifier = oauth.generate_verifier(VERIFIER_SIZE)
        session.commit()

        return request_token
Ejemplo n.º 2
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, '')
Ejemplo n.º 3
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, '')
Ejemplo n.º 4
0
    def authorize_request_token(self,
                                request,
                                oauth_request,
                                request_token,
                                session=None):
        request_token.is_approved = True
        request_token.user = request.user
        request_token.verifier = oauth.generate_verifier(VERIFIER_SIZE)
        session.commit()

        return request_token
Ejemplo n.º 5
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))
Ejemplo n.º 6
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))
Ejemplo n.º 7
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)
Ejemplo n.º 8
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)
Ejemplo n.º 9
0
 def authorize_request_token(self, request, oauth_request, request_token):
     request_token.is_approved = True
     request_token.user = request.user
     request_token.verifier = oauth.generate_verifier(VERIFIER_SIZE)
     request_token.save()
     return request_token
Ejemplo n.º 10
0
 def authorize_request_token(self, request, oauth_request, request_token):
     request_token.is_approved = True
     request_token.user = request.user
     request_token.verifier = oauth.generate_verifier(VERIFIER_SIZE)
     request_token.save()
     return request_token