summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-17 11:46:47 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-17 12:42:08 +0300
commitc8ab3b08102fba9dfad9d7d6a9494923a0e6d0bf (patch)
treee8b4c955d89721949b7207c367ef374ac427ae2f
parent4d3a53ff36526669fcde7b64dc947e8d76aba56b (diff)
downloadpoky-c8ab3b08102fba9dfad9d7d6a9494923a0e6d0bf.tar.gz
bitbake: test/fetch: Split the network tests from the rest of the fetcher tests
(Bitbake rev: f32265bcc6b4fe5566aca16f6b05555ec6a96d01) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/tests/fetch.py47
1 files changed, 24 insertions, 23 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index 8bf095ceea..a56d7daa3b 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -252,7 +252,7 @@ class URITest(unittest.TestCase):
252 self.assertEqual(str(uri), (str(uri).split(";"))[0]) 252 self.assertEqual(str(uri), (str(uri).split(";"))[0])
253 253
254 254
255class FetcherTest(unittest.TestCase): 255class FetcherUriTest(unittest.TestCase):
256 256
257 replaceuris = { 257 replaceuris = {
258 ("git://git.invalid.infradead.org/mtd-utils.git;tag=1234567890123456789012345678901234567890", "git://.*/.*", "http://somewhere.org/somedir/") 258 ("git://git.invalid.infradead.org/mtd-utils.git;tag=1234567890123456789012345678901234567890", "git://.*/.*", "http://somewhere.org/somedir/")
@@ -294,6 +294,29 @@ class FetcherTest(unittest.TestCase):
294 "https://.*/.* file:///someotherpath/downloads/ \n" \ 294 "https://.*/.* file:///someotherpath/downloads/ \n" \
295 "http://.*/.* file:///someotherpath/downloads/ \n" 295 "http://.*/.* file:///someotherpath/downloads/ \n"
296 296
297 def test_urireplace(self):
298 for k, v in self.replaceuris.items():
299 ud = bb.fetch.FetchData(k[0], self.d)
300 ud.setup_localpath(self.d)
301 mirrors = bb.fetch2.mirror_from_string("%s %s" % (k[1], k[2]))
302 newuris, uds = bb.fetch2.build_mirroruris(ud, mirrors, self.d)
303 self.assertEqual([v], newuris)
304
305 def test_urilist1(self):
306 fetcher = bb.fetch.FetchData("http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d)
307 mirrors = bb.fetch2.mirror_from_string(self.mirrorvar)
308 uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d)
309 self.assertEqual(uris, ['file:///somepath/downloads/bitbake-1.0.tar.gz', 'file:///someotherpath/downloads/bitbake-1.0.tar.gz'])
310
311 def test_urilist2(self):
312 # Catch https:// -> files:// bug
313 fetcher = bb.fetch.FetchData("https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d)
314 mirrors = bb.fetch2.mirror_from_string(self.mirrorvar)
315 uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d)
316 self.assertEqual(uris, ['file:///someotherpath/downloads/bitbake-1.0.tar.gz'])
317
318class FetcherTest(unittest.TestCase):
319
297 def setUp(self): 320 def setUp(self):
298 self.d = bb.data.init() 321 self.d = bb.data.init()
299 self.tempdir = tempfile.mkdtemp() 322 self.tempdir = tempfile.mkdtemp()
@@ -389,28 +412,6 @@ class FetcherTest(unittest.TestCase):
389 self.d.setVar("PREMIRRORS", "%s git://%s;protocol=file \n" % (dummyurl, self.sourcedir)) 412 self.d.setVar("PREMIRRORS", "%s git://%s;protocol=file \n" % (dummyurl, self.sourcedir))
390 self.gitfetcher(dummyurl, dummyurl) 413 self.gitfetcher(dummyurl, dummyurl)
391 414
392 def test_urireplace(self):
393 for k, v in self.replaceuris.items():
394 ud = bb.fetch.FetchData(k[0], self.d)
395 ud.setup_localpath(self.d)
396 mirrors = bb.fetch2.mirror_from_string("%s %s" % (k[1], k[2]))
397 newuris, uds = bb.fetch2.build_mirroruris(ud, mirrors, self.d)
398 self.assertEqual([v], newuris)
399
400 def test_urilist1(self):
401 fetcher = bb.fetch.FetchData("http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d)
402 mirrors = bb.fetch2.mirror_from_string(self.mirrorvar)
403 uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d)
404 self.assertEqual(uris, ['file:///somepath/downloads/bitbake-1.0.tar.gz', 'file:///someotherpath/downloads/bitbake-1.0.tar.gz'])
405
406 def test_urilist2(self):
407 # Catch https:// -> files:// bug
408 fetcher = bb.fetch.FetchData("https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d)
409 mirrors = bb.fetch2.mirror_from_string(self.mirrorvar)
410 uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d)
411 self.assertEqual(uris, ['file:///someotherpath/downloads/bitbake-1.0.tar.gz'])
412
413
414class URLHandle(unittest.TestCase): 415class URLHandle(unittest.TestCase):
415 416
416 datatable = { 417 datatable = {