Example #1
0
# -*- coding: utf-8 -*-
import time
import urllib
import re
from urlparse import parse_qs, urlparse
from django.test import TestCase, Client

import oauth2

from oauth_provider.models import Scope, Consumer, Token
from oauth_provider.compat import get_user_model

User = get_user_model()

METHOD_AUTHORIZATION_HEADER = 0
METHOD_POST_REQUEST_BODY = 1
METHOD_URL_QUERY = 2


class BaseOAuthTestCase(TestCase):
    def setUp(self):
        self.username = '******'
        self.password = '******'
        self.email = '*****@*****.**'
        self.jane = User.objects.create_user(self.username, self.email, self.password)
        self.scope = Scope.objects.create(name='photos', url='/oauth/photo/')

        self.CONSUMER_KEY = 'dpf43f3p2l4k3l03'
        self.CONSUMER_SECRET = 'kd94hf93k423kf44'

        consumer = self.consumer = Consumer(key=self.CONSUMER_KEY, secret=self.CONSUMER_SECRET,
Example #2
0
    def test_import_user_from_compat(self):
        from oauth_provider.compat import get_user_model
        from oauth_provider.compat import AUTH_USER_MODEL

        self.assertIsNotNone(get_user_model())
        self.assertIsNotNone(AUTH_USER_MODEL)