diff options
Diffstat (limited to 'bitbake/lib/bb/tests')
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index d56ef49948..d3f7b6ac6c 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -547,6 +547,43 @@ class FetcherNetworkTest(FetcherTest): | |||
547 | os.chdir(os.path.dirname(self.unpackdir)) | 547 | os.chdir(os.path.dirname(self.unpackdir)) |
548 | fetcher.unpack(self.unpackdir) | 548 | fetcher.unpack(self.unpackdir) |
549 | 549 | ||
550 | def test_trusted_network(self): | ||
551 | # Ensure trusted_network returns False when the host IS in the list. | ||
552 | url = "git://Someserver.org/foo;rev=1" | ||
553 | self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org someserver.org server2.org server3.org") | ||
554 | self.assertTrue(bb.fetch.trusted_network(self.d, url)) | ||
555 | |||
556 | def test_wild_trusted_network(self): | ||
557 | # Ensure trusted_network returns true when the *.host IS in the list. | ||
558 | url = "git://Someserver.org/foo;rev=1" | ||
559 | self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org *.someserver.org server2.org server3.org") | ||
560 | self.assertTrue(bb.fetch.trusted_network(self.d, url)) | ||
561 | |||
562 | def test_prefix_wild_trusted_network(self): | ||
563 | # Ensure trusted_network returns true when the prefix matches *.host. | ||
564 | url = "git://git.Someserver.org/foo;rev=1" | ||
565 | self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org *.someserver.org server2.org server3.org") | ||
566 | self.assertTrue(bb.fetch.trusted_network(self.d, url)) | ||
567 | |||
568 | def test_two_prefix_wild_trusted_network(self): | ||
569 | # Ensure trusted_network returns true when the prefix matches *.host. | ||
570 | url = "git://something.git.Someserver.org/foo;rev=1" | ||
571 | self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org *.someserver.org server2.org server3.org") | ||
572 | self.assertTrue(bb.fetch.trusted_network(self.d, url)) | ||
573 | |||
574 | def test_untrusted_network(self): | ||
575 | # Ensure trusted_network returns False when the host is NOT in the list. | ||
576 | url = "git://someserver.org/foo;rev=1" | ||
577 | self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org server2.org server3.org") | ||
578 | self.assertFalse(bb.fetch.trusted_network(self.d, url)) | ||
579 | |||
580 | def test_wild_untrusted_network(self): | ||
581 | # Ensure trusted_network returns False when the host is NOT in the list. | ||
582 | url = "git://*.someserver.org/foo;rev=1" | ||
583 | self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org server2.org server3.org") | ||
584 | self.assertFalse(bb.fetch.trusted_network(self.d, url)) | ||
585 | |||
586 | |||
550 | class URLHandle(unittest.TestCase): | 587 | class URLHandle(unittest.TestCase): |
551 | 588 | ||
552 | datatable = { | 589 | datatable = { |