diff options
Diffstat (limited to 'bitbake/lib/bb/tests/fetch.py')
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py new file mode 100644 index 0000000000..8bd3e89520 --- /dev/null +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -0,0 +1,42 @@ | |||
1 | # | ||
2 | # BitBake Tests for the Fetcher (fetch2/) | ||
3 | # | ||
4 | # Copyright (C) 2012 Richard Purdie | ||
5 | # | ||
6 | # This program is free software; you can redistribute it and/or modify | ||
7 | # it under the terms of the GNU General Public License version 2 as | ||
8 | # published by the Free Software Foundation. | ||
9 | # | ||
10 | # This program is distributed in the hope that it will be useful, | ||
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | # GNU General Public License for more details. | ||
14 | # | ||
15 | # You should have received a copy of the GNU General Public License along | ||
16 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | # | ||
19 | |||
20 | import unittest | ||
21 | import bb | ||
22 | |||
23 | class URLHandle(unittest.TestCase): | ||
24 | |||
25 | datatable = { | ||
26 | "http://www.google.com/index.html" : ('http', 'www.google.com', '/index.html', '', '', {}), | ||
27 | "cvs://anoncvs@cvs.handhelds.org/cvs;module=familiar/dist/ipkg" : ('cvs', 'cvs.handhelds.org', '/cvs', 'anoncvs', '', {'module': 'familiar/dist/ipkg'}), | ||
28 | "cvs://anoncvs:anonymous@cvs.handhelds.org/cvs;tag=V0-99-81;module=familiar/dist/ipkg" : ('cvs', 'cvs.handhelds.org', '/cvs', 'anoncvs', 'anonymous', {'tag': 'V0-99-81', 'module': 'familiar/dist/ipkg'}) | ||
29 | } | ||
30 | |||
31 | def test_decodeurl(self): | ||
32 | for k, v in self.datatable.items(): | ||
33 | result = bb.fetch.decodeurl(k) | ||
34 | self.assertEqual(result, v) | ||
35 | |||
36 | def test_encodeurl(self): | ||
37 | for k, v in self.datatable.items(): | ||
38 | result = bb.fetch.encodeurl(v) | ||
39 | self.assertEqual(result, k) | ||
40 | |||
41 | |||
42 | |||