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)
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)
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)
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)
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)
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)
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')
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)
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)
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)