Esempio n. 1
0
 def test_can_return_url(self):
     request = self.init_fake_request(server_name='server.example',
                                      request_uri='/media/view')
     self._inject_url_generator_for_request(request)
     assert_equals('/media/view', current_url(qualified=False))
     assert_equals('http://server.example:80/media/view',
                   current_url(qualified=True))
Esempio n. 2
0
 def test_proxy_deployment(self):
     self.pylons_config['proxy_prefix'] = '/proxy'
     request = self.init_fake_request(server_name='server.example', request_uri='/media/view')
     request.environ['SCRIPT_NAME'] = '/proxy'
     self._inject_url_generator_for_request(request)
     
     assert_equals('/proxy/media/view', current_url(qualified=False))
Esempio n. 3
0
 def test_can_return_correct_url_even_for_whoopsidasy_page(self):
     user_url = 'http://server.example:8080/media/view?id=123'
     user_environ = create_wsgi_environ(user_url, 'GET')
     user_request = Request(user_environ, charset='utf-8')
     self._inject_url_generator_for_request(user_request)
     
     error_request = self.init_fake_request(request_uri='/error/document')
     self._inject_url_generator_for_request(error_request)
     error_request.environ['pylons.original_request'] = user_request
     
     assert_equals(user_url, current_url())
Esempio n. 4
0
 def test_wsgi_deployment_in_a_subdirectory(self):
     request = self.init_fake_request(server_name='server.example', request_uri='/media/view')
     request.environ['SCRIPT_NAME'] = 'my_media'
     self._inject_url_generator_for_request(request)
     assert_equals('my_media/media/view', current_url(qualified=False))
Esempio n. 5
0
 def test_can_return_url_with_query_string(self):
     request = self.init_fake_request(server_name='server.example', 
         request_uri='/media/view?id=123')
     self._inject_url_generator_for_request(request)
     assert_equals('/media/view?id=123', current_url(qualified=False))
 def test_can_return_url(self):
     request = self.init_fake_request(server_name='server.example', request_uri='/media/view')
     self._inject_url_generator_for_request(request)
     assert_equals('/media/view', current_url(qualified=False))
     assert_equals('http://server.example:80/media/view', current_url(qualified=True))