summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tests
diff options
context:
space:
mode:
authorOlof Johansson <olof.johansson@axis.com>2014-01-20 12:03:22 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-24 17:54:46 +0000
commitaca2d14e9350fde58aaaa95cdeff5b051c1d38d3 (patch)
tree503fbfed656119128b0632b59fdbfc66fb7095d9 /bitbake/lib/bb/tests
parent64fdd3abbbe9ab99c3bc5083d4172ea7bc17bae3 (diff)
downloadpoky-aca2d14e9350fde58aaaa95cdeff5b051c1d38d3.tar.gz
bitbake: fetch2.URI: add support for query parameters
This change introduces the .query property of the URI class. It is a read/write dict of the parameters supplied in the query string of the URI. E.g.: http://example.com/?foo=bar => .query = {'foo': 'bar'} (Bitbake rev: 1cb2b3c458c8c5521591d2c8f2e0058143fc77bb) Signed-off-by: Olof Johansson <olof.johansson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tests')
-rw-r--r--bitbake/lib/bb/tests/fetch.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index f93a636586..15fe0ab2f2 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -39,6 +39,7 @@ class URITest(unittest.TestCase):
39 'username': '', 39 'username': '',
40 'password': '', 40 'password': '',
41 'params': {}, 41 'params': {},
42 'query': {},
42 'relative': False 43 'relative': False
43 }, 44 },
44 "http://www.google.com/index.html;param1=value1" : { 45 "http://www.google.com/index.html;param1=value1" : {
@@ -54,6 +55,23 @@ class URITest(unittest.TestCase):
54 'params': { 55 'params': {
55 'param1': 'value1' 56 'param1': 'value1'
56 }, 57 },
58 'query': {},
59 'relative': False
60 },
61 "http://www.example.org/index.html?param1=value1" : {
62 'uri': 'http://www.example.org/index.html?param1=value1',
63 'scheme': 'http',
64 'hostname': 'www.example.org',
65 'port': None,
66 'hostport': 'www.example.org',
67 'path': '/index.html',
68 'userinfo': '',
69 'username': '',
70 'password': '',
71 'params': {},
72 'query': {
73 'param1': 'value1'
74 },
57 'relative': False 75 'relative': False
58 }, 76 },
59 "http://www.example.com:8080/index.html" : { 77 "http://www.example.com:8080/index.html" : {
@@ -67,6 +85,7 @@ class URITest(unittest.TestCase):
67 'username': '', 85 'username': '',
68 'password': '', 86 'password': '',
69 'params': {}, 87 'params': {},
88 'query': {},
70 'relative': False 89 'relative': False
71 }, 90 },
72 "cvs://anoncvs@cvs.handhelds.org/cvs;module=familiar/dist/ipkg" : { 91 "cvs://anoncvs@cvs.handhelds.org/cvs;module=familiar/dist/ipkg" : {
@@ -82,6 +101,7 @@ class URITest(unittest.TestCase):
82 'params': { 101 'params': {
83 'module': 'familiar/dist/ipkg' 102 'module': 'familiar/dist/ipkg'
84 }, 103 },
104 'query': {},
85 'relative': False 105 'relative': False
86 }, 106 },
87 "cvs://anoncvs:anonymous@cvs.handhelds.org/cvs;tag=V0-99-81;module=familiar/dist/ipkg": { 107 "cvs://anoncvs:anonymous@cvs.handhelds.org/cvs;tag=V0-99-81;module=familiar/dist/ipkg": {
@@ -98,6 +118,7 @@ class URITest(unittest.TestCase):
98 'tag': 'V0-99-81', 118 'tag': 'V0-99-81',
99 'module': 'familiar/dist/ipkg' 119 'module': 'familiar/dist/ipkg'
100 }, 120 },
121 'query': {},
101 'relative': False 122 'relative': False
102 }, 123 },
103 "file://example.diff": { # NOTE: Not RFC compliant! 124 "file://example.diff": { # NOTE: Not RFC compliant!
@@ -111,6 +132,7 @@ class URITest(unittest.TestCase):
111 'username': '', 132 'username': '',
112 'password': '', 133 'password': '',
113 'params': {}, 134 'params': {},
135 'query': {},
114 'relative': True 136 'relative': True
115 }, 137 },
116 "file:example.diff": { # NOTE: RFC compliant version of the former 138 "file:example.diff": { # NOTE: RFC compliant version of the former
@@ -125,6 +147,7 @@ class URITest(unittest.TestCase):
125 'username': '', 147 'username': '',
126 'password': '', 148 'password': '',
127 'params': {}, 149 'params': {},
150 'query': {},
128 'relative': True 151 'relative': True
129 }, 152 },
130 "file:///tmp/example.diff": { 153 "file:///tmp/example.diff": {
@@ -139,6 +162,7 @@ class URITest(unittest.TestCase):
139 'username': '', 162 'username': '',
140 'password': '', 163 'password': '',
141 'params': {}, 164 'params': {},
165 'query': {},
142 'relative': False 166 'relative': False
143 }, 167 },
144 "git:///path/example.git": { 168 "git:///path/example.git": {
@@ -153,6 +177,7 @@ class URITest(unittest.TestCase):
153 'username': '', 177 'username': '',
154 'password': '', 178 'password': '',
155 'params': {}, 179 'params': {},
180 'query': {},
156 'relative': False 181 'relative': False
157 }, 182 },
158 "git:path/example.git": { 183 "git:path/example.git": {
@@ -167,6 +192,7 @@ class URITest(unittest.TestCase):
167 'username': '', 192 'username': '',
168 'password': '', 193 'password': '',
169 'params': {}, 194 'params': {},
195 'query': {},
170 'relative': True 196 'relative': True
171 }, 197 },
172 "git://example.net/path/example.git": { 198 "git://example.net/path/example.git": {
@@ -181,6 +207,7 @@ class URITest(unittest.TestCase):
181 'username': '', 207 'username': '',
182 'password': '', 208 'password': '',
183 'params': {}, 209 'params': {},
210 'query': {},
184 'relative': False 211 'relative': False
185 } 212 }
186 } 213 }
@@ -243,6 +270,9 @@ class URITest(unittest.TestCase):
243 uri.params = test['params'] 270 uri.params = test['params']
244 self.assertEqual(uri.params, test['params']) 271 self.assertEqual(uri.params, test['params'])
245 272
273 uri.query = test['query']
274 self.assertEqual(uri.query, test['query'])
275
246 self.assertEqual(str(uri), test['uri']) 276 self.assertEqual(str(uri), test['uri'])
247 277
248 uri.params = {} 278 uri.params = {}