Esempio n. 1
0
    def test_application_uri_http_host(self):
        environ = {
            'wsgi.url_scheme': 'http',
            'SERVER_NAME': '127.0.0.1',
            'SERVER_PORT': '8080',
            'HTTP_HOST': 'localhost:80'
        }
        self.assert_equal(uri.application_uri(environ), 'http://localhost/')

        environ = {
            'wsgi.url_scheme': 'http',
            'SERVER_NAME': '127.0.0.1',
            'SERVER_PORT': '80',
            'HTTP_HOST': 'localhost:8080'
        }
        self.assert_equal(uri.application_uri(environ),
                          'http://localhost:8080/')

        environ = {
            'wsgi.url_scheme': 'https',
            'SERVER_NAME': '127.0.0.1',
            'SERVER_PORT': '8008',
            'HTTP_HOST': 'localhost:443'
        }
        self.assert_equal(uri.application_uri(environ), 'https://localhost/')

        environ = {
            'wsgi.url_scheme': 'https',
            'SERVER_NAME': '127.0.0.1',
            'SERVER_PORT': '443',
            'HTTP_HOST': 'localhost:8008'
        }
        self.assert_equal(uri.application_uri(environ),
                          'https://localhost:8008/')
Esempio n. 2
0
    def test_application_uri_server_name(self):
        environ = {
            'wsgi.url_scheme': 'http',
            'SERVER_NAME': 'localhost',
            'SERVER_PORT': '80'
        }
        self.assert_equal(uri.application_uri(environ), 'http://localhost/')

        environ = {
            'wsgi.url_scheme': 'http',
            'SERVER_NAME': 'localhost',
            'SERVER_PORT': '8080'
        }
        self.assert_equal(uri.application_uri(environ),
                          'http://localhost:8080/')

        environ = {
            'wsgi.url_scheme': 'https',
            'SERVER_NAME': 'localhost',
            'SERVER_PORT': '443'
        }
        self.assert_equal(uri.application_uri(environ), 'https://localhost/')

        environ = {
            'wsgi.url_scheme': 'https',
            'SERVER_NAME': 'localhost',
            'SERVER_PORT': '8008'
        }
        self.assert_equal(uri.application_uri(environ),
                          'https://localhost:8008/')
Esempio n. 3
0
    def test_application_uri_script_name(self):
        environ = {'wsgi.url_scheme': 'https',
                   'HTTP_HOST': 'localhost'}
        self.assert_equal(uri.application_uri(environ), 'https://localhost/')

        environ = {'wsgi.url_scheme': 'https',
                   'HTTP_HOST': 'localhost',
                   'SCRIPT_NAME': ''}
        self.assert_equal(uri.application_uri(environ), 'https://localhost/')

        environ = {'wsgi.url_scheme': 'https',
                   'HTTP_HOST': 'localhost',
                   'SCRIPT_NAME': '/ayame'}
        self.assert_equal(uri.application_uri(environ), 'https://localhost/ayame')
Esempio n. 4
0
    def test_application_uri_script_name(self):
        environ = {'wsgi.url_scheme': 'https', 'HTTP_HOST': 'localhost'}
        self.assert_equal(uri.application_uri(environ), 'https://localhost/')

        environ = {
            'wsgi.url_scheme': 'https',
            'HTTP_HOST': 'localhost',
            'SCRIPT_NAME': ''
        }
        self.assert_equal(uri.application_uri(environ), 'https://localhost/')

        environ = {
            'wsgi.url_scheme': 'https',
            'HTTP_HOST': 'localhost',
            'SCRIPT_NAME': '/ayame'
        }
        self.assert_equal(uri.application_uri(environ),
                          'https://localhost/ayame')
Esempio n. 5
0
    def test_application_uri_server_name(self):
        environ = {'wsgi.url_scheme': 'http',
                   'SERVER_NAME': 'localhost',
                   'SERVER_PORT': '80'}
        self.assert_equal(uri.application_uri(environ), 'http://localhost/')

        environ = {'wsgi.url_scheme': 'http',
                   'SERVER_NAME': 'localhost',
                   'SERVER_PORT': '8080'}
        self.assert_equal(uri.application_uri(environ), 'http://localhost:8080/')

        environ = {'wsgi.url_scheme': 'https',
                   'SERVER_NAME': 'localhost',
                   'SERVER_PORT': '443'}
        self.assert_equal(uri.application_uri(environ), 'https://localhost/')

        environ = {'wsgi.url_scheme': 'https',
                   'SERVER_NAME': 'localhost',
                   'SERVER_PORT': '8008'}
        self.assert_equal(uri.application_uri(environ), 'https://localhost:8008/')
Esempio n. 6
0
    def test_application_uri_http_host(self):
        environ = {'wsgi.url_scheme': 'http',
                   'SERVER_NAME': '127.0.0.1',
                   'SERVER_PORT': '8080',
                   'HTTP_HOST': 'localhost:80'}
        self.assert_equal(uri.application_uri(environ), 'http://localhost/')

        environ = {'wsgi.url_scheme': 'http',
                   'SERVER_NAME': '127.0.0.1',
                   'SERVER_PORT': '80',
                   'HTTP_HOST': 'localhost:8080'}
        self.assert_equal(uri.application_uri(environ), 'http://localhost:8080/')

        environ = {'wsgi.url_scheme': 'https',
                   'SERVER_NAME': '127.0.0.1',
                   'SERVER_PORT': '8008',
                   'HTTP_HOST': 'localhost:443'}
        self.assert_equal(uri.application_uri(environ), 'https://localhost/')

        environ = {'wsgi.url_scheme': 'https',
                   'SERVER_NAME': '127.0.0.1',
                   'SERVER_PORT': '443',
                   'HTTP_HOST': 'localhost:8008'}
        self.assert_equal(uri.application_uri(environ), 'https://localhost:8008/')