示例#1
0
    def setUp(self):
        self.factory = RequestFactory()
        self.request = self.factory.get(path=reverse('idPage'))
        # Set up the OpenID request we're responding to.
        op_endpoint = 'http://127.0.0.1:8080/endpoint'
        message = Message.fromPostArgs({
            'openid.mode': 'checkid_setup',
            'openid.identity': reverse('idPage'),
            'openid.return_to': 'http://127.0.0.1/%s' % (self.id(),),
            'openid.sreg.required': 'postcode',
            })
        self.openid_request = CheckIDRequest.fromMessage(message, op_endpoint)

        views.setRequest(self.request, self.openid_request)
示例#2
0
文件: tests.py 项目: bearstech/OursID
def dummyOidRequest(request, id, id_url, return_url = None):
    """Build an openid_request with id_url
    """
    # Set up the OpenID request we're responding to.
    op_endpoint = 'http://127.0.0.1:8080/endpoint'
    if return_url == None:
        return_url = 'http://127.0.0.1/%s' % (id,)
    message = Message.fromPostArgs({
        'openid.mode': 'checkid_setup',
        'openid.claimed_id': '',
        'openid.identity': id_url,
        'openid.return_to': return_url,
        'openid.sreg.required': 'postcode',
        })
    return CheckIDRequest.fromMessage(message, op_endpoint)
示例#3
0
    def setUp(self):
        self.request = dummyRequest()

        id_url = util.getViewURL(self.request, views.idPage)

        # Set up the OpenID request we're responding to.
        op_endpoint = 'http://127.0.0.1:8080/endpoint'
        message = Message.fromPostArgs({
            'openid.mode': 'checkid_setup',
            'openid.identity': id_url,
            'openid.return_to': 'http://127.0.0.1/%s' % (self.id(),),
            'openid.sreg.required': 'postcode',
            })
        self.openid_request = CheckIDRequest.fromMessage(message, op_endpoint)

        views.setRequest(self.request, self.openid_request)
示例#4
0
    def setUp(self):
        self.request = dummyRequest()

        id_url = urljoin('http://example.cz/', reverse('server:local_id'))

        # Set up the OpenID request we're responding to.
        op_endpoint = 'http://127.0.0.1:8080/endpoint'
        message = Message.fromPostArgs({
            'openid.mode': 'checkid_setup',
            'openid.identity': id_url,
            'openid.return_to': 'http://127.0.0.1/%s' % (self.id(),),
            'openid.sreg.required': 'postcode',
        })
        self.openid_request = CheckIDRequest.fromMessage(message, op_endpoint)

        views.setRequest(self.request, self.openid_request)
示例#5
0
    def setUp(self):
        self.request = dummyRequest()

        id_url = util.getViewURL(self.request, 'profile_view', args=('normal',))

        # Set up the OpenID request we're responding to.
        op_endpoint = 'http://127.0.0.1:8080/endpoint'
        message = Message.fromPostArgs({
            'openid.mode': 'checkid_setup',
            'openid.identity': id_url,
            'openid.return_to': 'http://127.0.0.1/%s' % (self.id(),),
            })
        self.openid_request = CheckIDRequest.fromMessage(message, op_endpoint)

        server_util.authorizeOpenId(self.request, User.objects.get(
                username='******'))
        views.setRequest(self.request, self.openid_request)
示例#6
0
    def setUp(self):
        self.request = dummyRequest()

        id_url = util.get_view_url(self.request, views.idPage)

        # Set up the OpenID request we're responding to.
        op_endpoint = "http://127.0.0.1:8080/endpoint"
        message = Message.fromPostArgs(
            {
                "openid.mode": "checkid_setup",
                "openid.identity": id_url,
                "openid.return_to": "http://127.0.0.1/%s" % (self.id(),),
                "openid.sreg.required": "postcode",
            }
        )
        self.openid_request = CheckIDRequest.fromMessage(message, op_endpoint)

        views.set_request(self.request, self.openid_request)
示例#7
0
    def test_unreachableRealm(self):
        self.request = dummyRequest()

        id_url = util.getViewURL(self.request, views.idPage)

        # Set up the OpenID request we're responding to.
        op_endpoint = 'http://127.0.0.1:8080/endpoint'
        message = Message.fromPostArgs({
            'openid.mode': 'checkid_setup',
            'openid.identity': id_url,
            'openid.return_to': 'http://unreachable.invalid/%s' % (self.id(),),
            'openid.sreg.required': 'postcode',
            })
        self.openid_request = CheckIDRequest.fromMessage(message, op_endpoint)

        views.setRequest(self.request, self.openid_request)

        response = views.showDecidePage(self.request, self.openid_request)
        self.assertContains(response, 'trust_root_valid is Unreachable')
示例#8
0
    def setUp(self):
        self.request = dummyRequest()

        id_url = urljoin('http://example.cz/', reverse('server:local_id'))

        # Set up the OpenID request we're responding to.
        op_endpoint = 'http://127.0.0.1:8080/endpoint'
        message = Message.fromPostArgs({
            'openid.mode':
            'checkid_setup',
            'openid.identity':
            id_url,
            'openid.return_to':
            'http://127.0.0.1/%s' % (self.id(), ),
            'openid.sreg.required':
            'postcode',
        })
        self.openid_request = CheckIDRequest.fromMessage(message, op_endpoint)

        views.setRequest(self.request, self.openid_request)
示例#9
0
    def test_unreachableRealm(self):
        self.request = dummyRequest()

        id_url = util.get_view_url(self.request, views.idPage)

        # Set up the OpenID request we're responding to.
        op_endpoint = "http://127.0.0.1:8080/endpoint"
        message = Message.fromPostArgs(
            {
                "openid.mode": "checkid_setup",
                "openid.identity": id_url,
                "openid.return_to": "http://unreachable.invalid/%s" % (self.id(),),
                "openid.sreg.required": "postcode",
            }
        )
        self.openid_request = CheckIDRequest.fromMessage(message, op_endpoint)

        views.set_request(self.request, self.openid_request)

        response = views.show_decide_page(self.request, self.openid_request)
        self.failUnless("trust_root_valid is Unreachable" in response.content, response)
示例#10
0
    def test_unreachableRealm(self):
        self.request = dummyRequest()

        id_url = urljoin('http://example.cz/', reverse('server:local_id'))

        # Set up the OpenID request we're responding to.
        op_endpoint = 'http://127.0.0.1:8080/endpoint'
        message = Message.fromPostArgs({
            'openid.mode':
            'checkid_setup',
            'openid.identity':
            id_url,
            'openid.return_to':
            'http://unreachable.invalid/%s' % (self.id(), ),
            'openid.sreg.required':
            'postcode',
        })
        self.openid_request = CheckIDRequest.fromMessage(message, op_endpoint)

        views.setRequest(self.request, self.openid_request)

        response = views.showDecidePage(self.request, self.openid_request)
        self.assertIn('trust_root_valid is Unreachable', response.content)