Example #1
0
    def test_request_uri_query_string(self):
        environ = {
            'wsgi.url_scheme': 'http',
            'HTTP_HOST': 'localhost',
            'SCRIPT_NAME': '/ayame',
            'PATH_INFO': '/'
        }
        self.assert_equal(uri.request_uri(environ, True),
                          'http://localhost/ayame/')

        environ = {
            'wsgi.url_scheme': 'http',
            'HTTP_HOST': 'localhost',
            'SCRIPT_NAME': '/ayame',
            'PATH_INFO': '/',
            'QUERY_STRING': ''
        }
        self.assert_equal(uri.request_uri(environ, True),
                          'http://localhost/ayame/')

        environ = {
            'wsgi.url_scheme': 'http',
            'HTTP_HOST': 'localhost',
            'SCRIPT_NAME': '/ayame',
            'PATH_INFO': '/',
            'QUERY_STRING': 'FrontPage'
        }
        self.assert_equal(uri.request_uri(environ, True),
                          'http://localhost/ayame/?FrontPage')
Example #2
0
    def test_request_uri_script_name(self):
        # PATH_INFO is empty
        environ = {
            'wsgi.url_scheme': 'http',
            'HTTP_HOST': 'localhost',
            'SCRIPT_NAME': '/ayame'
        }
        self.assert_equal(uri.request_uri(environ), 'http://localhost/ayame')

        environ = {
            'wsgi.url_scheme': 'http',
            'HTTP_HOST': 'localhost',
            'SCRIPT_NAME': '/ayame',
            'PATH_INFO': ''
        }
        self.assert_equal(uri.request_uri(environ), 'http://localhost/ayame')

        # SCRIPT_NAME and PATH_INFO
        environ = {
            'wsgi.url_scheme': 'http',
            'HTTP_HOST': 'localhost',
            'SCRIPT_NAME': '/ayame',
            'PATH_INFO': '/'
        }
        self.assert_equal(uri.request_uri(environ), 'http://localhost/ayame/')
Example #3
0
    def test_request_uri(self):
        # SCRIPT_NAME and PATH_INFO are empty
        environ = {'wsgi.url_scheme': 'http',
                   'HTTP_HOST': 'localhost'}
        self.assert_equal(uri.request_uri(environ), 'http://localhost/')

        # SCRIPT_NAME is empty
        environ = {'wsgi.url_scheme': 'http',
                   'HTTP_HOST': 'localhost',
                   'PATH_INFO': '/'}
        self.assert_equal(uri.request_uri(environ), 'http://localhost/')

        environ = {'wsgi.url_scheme': 'http',
                   'HTTP_HOST': 'localhost',
                   'SCRIPT_NAME': '',
                   'PATH_INFO': '/'}
        self.assert_equal(uri.request_uri(environ), 'http://localhost/')
Example #4
0
    def test_request_uri_script_name(self):
        # PATH_INFO is empty
        environ = {'wsgi.url_scheme': 'http',
                   'HTTP_HOST': 'localhost',
                   'SCRIPT_NAME': '/ayame'}
        self.assert_equal(uri.request_uri(environ), 'http://localhost/ayame')

        environ = {'wsgi.url_scheme': 'http',
                   'HTTP_HOST': 'localhost',
                   'SCRIPT_NAME': '/ayame',
                   'PATH_INFO': ''}
        self.assert_equal(uri.request_uri(environ), 'http://localhost/ayame')

        # SCRIPT_NAME and PATH_INFO
        environ = {'wsgi.url_scheme': 'http',
                   'HTTP_HOST': 'localhost',
                   'SCRIPT_NAME': '/ayame',
                   'PATH_INFO': '/'}
        self.assert_equal(uri.request_uri(environ), 'http://localhost/ayame/')
Example #5
0
    def test_request_uri(self):
        # SCRIPT_NAME and PATH_INFO are empty
        environ = {'wsgi.url_scheme': 'http', 'HTTP_HOST': 'localhost'}
        self.assert_equal(uri.request_uri(environ), 'http://localhost/')

        # SCRIPT_NAME is empty
        environ = {
            'wsgi.url_scheme': 'http',
            'HTTP_HOST': 'localhost',
            'PATH_INFO': '/'
        }
        self.assert_equal(uri.request_uri(environ), 'http://localhost/')

        environ = {
            'wsgi.url_scheme': 'http',
            'HTTP_HOST': 'localhost',
            'SCRIPT_NAME': '',
            'PATH_INFO': '/'
        }
        self.assert_equal(uri.request_uri(environ), 'http://localhost/')
Example #6
0
    def test_request_uri_query_string(self):
        environ = {'wsgi.url_scheme': 'http',
                   'HTTP_HOST': 'localhost',
                   'SCRIPT_NAME': '/ayame',
                   'PATH_INFO': '/'}
        self.assert_equal(uri.request_uri(environ, True), 'http://localhost/ayame/')

        environ = {'wsgi.url_scheme': 'http',
                   'HTTP_HOST': 'localhost',
                   'SCRIPT_NAME': '/ayame',
                   'PATH_INFO': '/',
                   'QUERY_STRING': ''}
        self.assert_equal(uri.request_uri(environ, True), 'http://localhost/ayame/')

        environ = {'wsgi.url_scheme': 'http',
                   'HTTP_HOST': 'localhost',
                   'SCRIPT_NAME': '/ayame',
                   'PATH_INFO': '/',
                   'QUERY_STRING': 'FrontPage'}
        self.assert_equal(uri.request_uri(environ, True), 'http://localhost/ayame/?FrontPage')