コード例 #1
0
    def test_validate_correct_access_token(self):
        client = OAuthClient()
        client.name = 'test app'
        client.save()

        token = Token()
        token.type = Token.ACCESS_TOKEN
        token.client = client
        token.save()

        self.assertTrue(self.oauth_server.validate_access_token(access_token=token.key, client_key=token.client.key))
コード例 #2
0
    def setUpClass(cls):
        oauth_client = OAuthClient()
        oauth_client.callback_uri = 'oob'
        oauth_client.name = 'test app'
        oauth_client.created_by = User.objects.create_user('tester', '*****@*****.**', 'peekaboo')
        oauth_client.save()

        cls.oauth_server = DjangoOAuthServer()

        cls.client = Client()

        cls.oauth_client_key = oauth_client.key
        cls.oauth_client_secret = oauth_client.secret
        cls.oauth_client_callback_uri = oauth_client.callback_uri

        oauth_token = Token()
        oauth_token.client = oauth_client
        oauth_token.type = Token.REQUEST_TOKEN
        oauth_token.save()

        cls.oauth_token = oauth_token.key
        cls.oauth_token_secret = oauth_token.secret