Index: prebuilt_unittest.py |
diff --git a/prebuilt_unittest.py b/prebuilt_unittest.py |
index 4c7255e3c5c3ab21d4794c1f5b93e61340a5211e..a39aabcef6e4e0077c695b223c108001ffc37d63 100755 |
--- a/prebuilt_unittest.py |
+++ b/prebuilt_unittest.py |
@@ -10,11 +10,13 @@ import prebuilt |
import shutil |
import tempfile |
import unittest |
+import urllib |
from chromite.lib import cros_build_lib |
from chromite.lib.binpkg import PackageIndex |
-PUBLIC_PACKAGES = [{'CPV': 'public1', 'SHA1': '1'}, |
- {'CPV': 'public2', 'SHA1': '2', 'PATH': 'foo.tgz'}] |
+PUBLIC_PACKAGES = [{'CPV': 'gtk+/public1', 'SHA1': '1'}, |
+ {'CPV': 'gtk+/public2', 'SHA1': '2', |
+ 'PATH': 'gtk%2B/foo.tgz'}] |
PRIVATE_PACKAGES = [{'CPV': 'private', 'SHA1': '3'}] |
@@ -217,8 +219,8 @@ class TestPopulateDuplicateDB(unittest.TestCase): |
db = {} |
pkgindex._PopulateDuplicateDB(db) |
self.assertEqual(len(db), 3) |
- self.assertEqual(db['1'], 'http://www.example.com/public1.tbz2') |
- self.assertEqual(db['2'], 'http://www.example.com/foo.tgz') |
+ self.assertEqual(db['1'], 'http://www.example.com/gtk%2B/public1.tbz2') |
+ self.assertEqual(db['2'], 'http://www.example.com/gtk%2B/foo.tgz') |
self.assertEqual(db['3'], 'http://www.example.com/private.tbz2') |
def testMissingSHA1(self): |
@@ -227,7 +229,7 @@ class TestPopulateDuplicateDB(unittest.TestCase): |
del pkgindex.packages[0]['SHA1'] |
pkgindex._PopulateDuplicateDB(db) |
self.assertEqual(len(db), 2) |
- self.assertEqual(db['2'], 'http://www.example.com/foo.tgz') |
+ self.assertEqual(db['2'], 'http://www.example.com/gtk%2B/foo.tgz') |
self.assertEqual(db['3'], 'http://www.example.com/private.tbz2') |
def testFailedPopulate(self): |
@@ -263,7 +265,7 @@ class TestResolveDuplicateUploads(unittest.TestCase): |
dup_pkgindex = SimplePackageIndex() |
expected_pkgindex = SimplePackageIndex() |
for pkg in expected_pkgindex.packages: |
- pkg.setdefault('PATH', pkg['CPV'] + '.tbz2') |
+ pkg.setdefault('PATH', urllib.quote(pkg['CPV'] + '.tbz2')) |
uploads = pkgindex.ResolveDuplicateUploads([dup_pkgindex]) |
self.assertEqual(pkgindex.packages, expected_pkgindex.packages) |