annotate tests/test-wsgirequest.py @ 36902:b2a3308d6a21

tests: add test coverage for parsing WSGI requests A subsequent commit will need to make this code more complicated in order to support alternate base URLs. Let's establish some test coverage before we diverge too far from PEP 3333. As part of this, a minor bug related to a missing SCRIPT_NAME key has been squashed. Differential Revision: https://phab.mercurial-scm.org/D2818
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 11 Mar 2018 12:53:47 -0700
parents
children d7fd203e36cc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
36902
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1 from __future__ import absolute_import, print_function
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
2
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
3 import unittest
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
4
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
5 from mercurial.hgweb import (
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
6 request as requestmod,
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
7 )
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
8
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
9 DEFAULT_ENV = {
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
10 r'REQUEST_METHOD': r'GET',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
11 r'SERVER_NAME': r'testserver',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
12 r'SERVER_PORT': r'80',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
13 r'SERVER_PROTOCOL': r'http',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
14 r'wsgi.version': (1, 0),
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
15 r'wsgi.url_scheme': r'http',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
16 r'wsgi.input': None,
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
17 r'wsgi.errors': None,
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
18 r'wsgi.multithread': False,
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
19 r'wsgi.multiprocess': True,
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
20 r'wsgi.run_once': False,
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
21 }
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
22
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
23 def parse(env, bodyfh=None, extra=None):
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
24 env = dict(env)
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
25 env.update(extra or {})
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
26
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
27 return requestmod.parserequestfromenv(env, bodyfh)
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
28
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
29 class ParseRequestTests(unittest.TestCase):
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
30 def testdefault(self):
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
31 r = parse(DEFAULT_ENV)
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
32 self.assertEqual(r.url, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
33 self.assertEqual(r.baseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
34 self.assertEqual(r.advertisedurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
35 self.assertEqual(r.advertisedbaseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
36 self.assertEqual(r.urlscheme, b'http')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
37 self.assertEqual(r.method, b'GET')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
38 self.assertIsNone(r.remoteuser)
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
39 self.assertIsNone(r.remotehost)
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
40 self.assertEqual(r.apppath, b'')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
41 self.assertEqual(r.dispatchparts, [])
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
42 self.assertEqual(r.dispatchpath, b'')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
43 self.assertFalse(r.havepathinfo)
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
44 self.assertIsNone(r.reponame)
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
45 self.assertEqual(r.querystring, b'')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
46 self.assertEqual(len(r.qsparams), 0)
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
47 self.assertEqual(len(r.headers), 0)
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
48
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
49 def testcustomport(self):
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
50 r = parse(DEFAULT_ENV, extra={
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
51 r'SERVER_PORT': r'8000',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
52 })
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
53
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
54 self.assertEqual(r.url, b'http://testserver:8000')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
55 self.assertEqual(r.baseurl, b'http://testserver:8000')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
56 self.assertEqual(r.advertisedurl, b'http://testserver:8000')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
57 self.assertEqual(r.advertisedbaseurl, b'http://testserver:8000')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
58
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
59 r = parse(DEFAULT_ENV, extra={
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
60 r'SERVER_PORT': r'4000',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
61 r'wsgi.url_scheme': r'https',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
62 })
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
63
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
64 self.assertEqual(r.url, b'https://testserver:4000')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
65 self.assertEqual(r.baseurl, b'https://testserver:4000')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
66 self.assertEqual(r.advertisedurl, b'https://testserver:4000')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
67 self.assertEqual(r.advertisedbaseurl, b'https://testserver:4000')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
68
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
69 def testhttphost(self):
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
70 r = parse(DEFAULT_ENV, extra={
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
71 r'HTTP_HOST': r'altserver',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
72 })
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
73
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
74 self.assertEqual(r.url, b'http://altserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
75 self.assertEqual(r.baseurl, b'http://altserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
76 self.assertEqual(r.advertisedurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
77 self.assertEqual(r.advertisedbaseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
78
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
79 def testscriptname(self):
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
80 r = parse(DEFAULT_ENV, extra={
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
81 r'SCRIPT_NAME': r'',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
82 })
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
83
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
84 self.assertEqual(r.url, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
85 self.assertEqual(r.baseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
86 self.assertEqual(r.advertisedurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
87 self.assertEqual(r.advertisedbaseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
88 self.assertEqual(r.apppath, b'')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
89 self.assertEqual(r.dispatchparts, [])
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
90 self.assertEqual(r.dispatchpath, b'')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
91 self.assertFalse(r.havepathinfo)
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
92
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
93 r = parse(DEFAULT_ENV, extra={
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
94 r'SCRIPT_NAME': r'/script',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
95 })
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
96
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
97 self.assertEqual(r.url, b'http://testserver/script')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
98 self.assertEqual(r.baseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
99 self.assertEqual(r.advertisedurl, b'http://testserver/script')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
100 self.assertEqual(r.advertisedbaseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
101 self.assertEqual(r.apppath, b'/script')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
102 self.assertEqual(r.dispatchparts, [])
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
103 self.assertEqual(r.dispatchpath, b'')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
104 self.assertFalse(r.havepathinfo)
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
105
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
106 r = parse(DEFAULT_ENV, extra={
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
107 r'SCRIPT_NAME': r'/multiple words',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
108 })
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
109
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
110 self.assertEqual(r.url, b'http://testserver/multiple%20words')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
111 self.assertEqual(r.baseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
112 self.assertEqual(r.advertisedurl, b'http://testserver/multiple%20words')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
113 self.assertEqual(r.advertisedbaseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
114 self.assertEqual(r.apppath, b'/multiple words')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
115 self.assertEqual(r.dispatchparts, [])
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
116 self.assertEqual(r.dispatchpath, b'')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
117 self.assertFalse(r.havepathinfo)
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
118
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
119 def testpathinfo(self):
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
120 r = parse(DEFAULT_ENV, extra={
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
121 r'PATH_INFO': r'',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
122 })
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
123
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
124 self.assertEqual(r.url, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
125 self.assertEqual(r.baseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
126 self.assertEqual(r.advertisedurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
127 self.assertEqual(r.advertisedbaseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
128 self.assertEqual(r.apppath, b'')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
129 self.assertEqual(r.dispatchparts, [])
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
130 self.assertEqual(r.dispatchpath, b'')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
131 self.assertTrue(r.havepathinfo)
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
132
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
133 r = parse(DEFAULT_ENV, extra={
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
134 r'PATH_INFO': r'/pathinfo',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
135 })
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
136
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
137 self.assertEqual(r.url, b'http://testserver/pathinfo')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
138 self.assertEqual(r.baseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
139 self.assertEqual(r.advertisedurl, b'http://testserver/pathinfo')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
140 self.assertEqual(r.advertisedbaseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
141 self.assertEqual(r.apppath, b'')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
142 self.assertEqual(r.dispatchparts, [b'pathinfo'])
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
143 self.assertEqual(r.dispatchpath, b'pathinfo')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
144 self.assertTrue(r.havepathinfo)
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
145
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
146 r = parse(DEFAULT_ENV, extra={
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
147 r'PATH_INFO': r'/one/two/',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
148 })
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
149
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
150 self.assertEqual(r.url, b'http://testserver/one/two/')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
151 self.assertEqual(r.baseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
152 self.assertEqual(r.advertisedurl, b'http://testserver/one/two/')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
153 self.assertEqual(r.advertisedbaseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
154 self.assertEqual(r.apppath, b'')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
155 self.assertEqual(r.dispatchparts, [b'one', b'two'])
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
156 self.assertEqual(r.dispatchpath, b'one/two')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
157 self.assertTrue(r.havepathinfo)
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
158
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
159 def testscriptandpathinfo(self):
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
160 r = parse(DEFAULT_ENV, extra={
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
161 r'SCRIPT_NAME': r'/script',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
162 r'PATH_INFO': r'/pathinfo',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
163 })
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
164
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
165 self.assertEqual(r.url, b'http://testserver/script/pathinfo')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
166 self.assertEqual(r.baseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
167 self.assertEqual(r.advertisedurl, b'http://testserver/script/pathinfo')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
168 self.assertEqual(r.advertisedbaseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
169 self.assertEqual(r.apppath, b'/script')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
170 self.assertEqual(r.dispatchparts, [b'pathinfo'])
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
171 self.assertEqual(r.dispatchpath, b'pathinfo')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
172 self.assertTrue(r.havepathinfo)
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
173
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
174 r = parse(DEFAULT_ENV, extra={
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
175 r'SCRIPT_NAME': r'/script1/script2',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
176 r'PATH_INFO': r'/path1/path2',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
177 })
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
178
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
179 self.assertEqual(r.url,
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
180 b'http://testserver/script1/script2/path1/path2')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
181 self.assertEqual(r.baseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
182 self.assertEqual(r.advertisedurl,
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
183 b'http://testserver/script1/script2/path1/path2')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
184 self.assertEqual(r.advertisedbaseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
185 self.assertEqual(r.apppath, b'/script1/script2')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
186 self.assertEqual(r.dispatchparts, [b'path1', b'path2'])
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
187 self.assertEqual(r.dispatchpath, b'path1/path2')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
188 self.assertTrue(r.havepathinfo)
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
189
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
190 r = parse(DEFAULT_ENV, extra={
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
191 r'HTTP_HOST': r'hostserver',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
192 r'SCRIPT_NAME': r'/script',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
193 r'PATH_INFO': r'/pathinfo',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
194 })
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
195
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
196 self.assertEqual(r.url, b'http://hostserver/script/pathinfo')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
197 self.assertEqual(r.baseurl, b'http://hostserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
198 self.assertEqual(r.advertisedurl, b'http://testserver/script/pathinfo')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
199 self.assertEqual(r.advertisedbaseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
200 self.assertEqual(r.apppath, b'/script')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
201 self.assertEqual(r.dispatchparts, [b'pathinfo'])
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
202 self.assertEqual(r.dispatchpath, b'pathinfo')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
203 self.assertTrue(r.havepathinfo)
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
204
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
205 def testreponame(self):
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
206 """REPO_NAME path components get stripped from URL."""
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
207 r = parse(DEFAULT_ENV, extra={
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
208 r'REPO_NAME': r'repo',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
209 r'PATH_INFO': r'/path1/path2'
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
210 })
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
211
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
212 self.assertEqual(r.url, b'http://testserver/path1/path2')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
213 self.assertEqual(r.baseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
214 self.assertEqual(r.advertisedurl, b'http://testserver/path1/path2')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
215 self.assertEqual(r.advertisedbaseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
216 self.assertEqual(r.apppath, b'/repo')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
217 self.assertEqual(r.dispatchparts, [b'path1', b'path2'])
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
218 self.assertEqual(r.dispatchpath, b'path1/path2')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
219 self.assertTrue(r.havepathinfo)
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
220 self.assertEqual(r.reponame, b'repo')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
221
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
222 r = parse(DEFAULT_ENV, extra={
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
223 r'REPO_NAME': r'repo',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
224 r'PATH_INFO': r'/repo/path1/path2',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
225 })
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
226
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
227 self.assertEqual(r.url, b'http://testserver/repo/path1/path2')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
228 self.assertEqual(r.baseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
229 self.assertEqual(r.advertisedurl, b'http://testserver/repo/path1/path2')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
230 self.assertEqual(r.advertisedbaseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
231 self.assertEqual(r.apppath, b'/repo')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
232 self.assertEqual(r.dispatchparts, [b'path1', b'path2'])
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
233 self.assertEqual(r.dispatchpath, b'path1/path2')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
234 self.assertTrue(r.havepathinfo)
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
235 self.assertEqual(r.reponame, b'repo')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
236
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
237 r = parse(DEFAULT_ENV, extra={
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
238 r'REPO_NAME': r'prefix/repo',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
239 r'PATH_INFO': r'/prefix/repo/path1/path2',
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
240 })
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
241
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
242 self.assertEqual(r.url, b'http://testserver/prefix/repo/path1/path2')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
243 self.assertEqual(r.baseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
244 self.assertEqual(r.advertisedurl,
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
245 b'http://testserver/prefix/repo/path1/path2')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
246 self.assertEqual(r.advertisedbaseurl, b'http://testserver')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
247 self.assertEqual(r.apppath, b'/prefix/repo')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
248 self.assertEqual(r.dispatchparts, [b'path1', b'path2'])
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
249 self.assertEqual(r.dispatchpath, b'path1/path2')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
250 self.assertTrue(r.havepathinfo)
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
251 self.assertEqual(r.reponame, b'prefix/repo')
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
252
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
253 if __name__ == '__main__':
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
254 import silenttestrunner
b2a3308d6a21 tests: add test coverage for parsing WSGI requests
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
255 silenttestrunner.main(__name__)