aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/tests/fetch.py
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 10:13:25 +0000
commit1cb2b3c458c8c5521591d2c8f2e0058143fc77bb (patch)
tree44d0814f89e1e73986e53779ca435ec9323609a0 /lib/bb/tests/fetch.py
parentf112660bca0ed8be061055b1e388deeb2d1980a7 (diff)
downloadbitbake-contrib-1cb2b3c458c8c5521591d2c8f2e0058143fc77bb.tar.gz
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'} Signed-off-by: Olof Johansson <olof.johansson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/tests/fetch.py')
-rw-r--r--lib/bb/tests/fetch.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index f93a63658..15fe0ab2f 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -39,6 +39,7 @@ class URITest(unittest.TestCase):
'username': '',
'password': '',
'params': {},
+ 'query': {},
'relative': False
},
"http://www.google.com/index.html;param1=value1" : {
@@ -54,6 +55,23 @@ class URITest(unittest.TestCase):
'params': {
'param1': 'value1'
},
+ 'query': {},
+ 'relative': False
+ },
+ "http://www.example.org/index.html?param1=value1" : {
+ 'uri': 'http://www.example.org/index.html?param1=value1',
+ 'scheme': 'http',
+ 'hostname': 'www.example.org',
+ 'port': None,
+ 'hostport': 'www.example.org',
+ 'path': '/index.html',
+ 'userinfo': '',
+ 'username': '',
+ 'password': '',
+ 'params': {},
+ 'query': {
+ 'param1': 'value1'
+ },
'relative': False
},
"http://www.example.com:8080/index.html" : {
@@ -67,6 +85,7 @@ class URITest(unittest.TestCase):
'username': '',
'password': '',
'params': {},
+ 'query': {},
'relative': False
},
"cvs://anoncvs@cvs.handhelds.org/cvs;module=familiar/dist/ipkg" : {
@@ -82,6 +101,7 @@ class URITest(unittest.TestCase):
'params': {
'module': 'familiar/dist/ipkg'
},
+ 'query': {},
'relative': False
},
"cvs://anoncvs:anonymous@cvs.handhelds.org/cvs;tag=V0-99-81;module=familiar/dist/ipkg": {
@@ -98,6 +118,7 @@ class URITest(unittest.TestCase):
'tag': 'V0-99-81',
'module': 'familiar/dist/ipkg'
},
+ 'query': {},
'relative': False
},
"file://example.diff": { # NOTE: Not RFC compliant!
@@ -111,6 +132,7 @@ class URITest(unittest.TestCase):
'username': '',
'password': '',
'params': {},
+ 'query': {},
'relative': True
},
"file:example.diff": { # NOTE: RFC compliant version of the former
@@ -125,6 +147,7 @@ class URITest(unittest.TestCase):
'username': '',
'password': '',
'params': {},
+ 'query': {},
'relative': True
},
"file:///tmp/example.diff": {
@@ -139,6 +162,7 @@ class URITest(unittest.TestCase):
'username': '',
'password': '',
'params': {},
+ 'query': {},
'relative': False
},
"git:///path/example.git": {
@@ -153,6 +177,7 @@ class URITest(unittest.TestCase):
'username': '',
'password': '',
'params': {},
+ 'query': {},
'relative': False
},
"git:path/example.git": {
@@ -167,6 +192,7 @@ class URITest(unittest.TestCase):
'username': '',
'password': '',
'params': {},
+ 'query': {},
'relative': True
},
"git://example.net/path/example.git": {
@@ -181,6 +207,7 @@ class URITest(unittest.TestCase):
'username': '',
'password': '',
'params': {},
+ 'query': {},
'relative': False
}
}
@@ -243,6 +270,9 @@ class URITest(unittest.TestCase):
uri.params = test['params']
self.assertEqual(uri.params, test['params'])
+ uri.query = test['query']
+ self.assertEqual(uri.query, test['query'])
+
self.assertEqual(str(uri), test['uri'])
uri.params = {}