Merge lp:~cjwatson/launchpad/archivepublisher-tests-future-imports into lp:launchpad
- archivepublisher-tests-future-imports
- Merge into devel
Proposed by
Colin Watson
Status: | Merged |
---|---|
Merged at revision: | 18570 |
Proposed branch: | lp:~cjwatson/launchpad/archivepublisher-tests-future-imports |
Merge into: | lp:launchpad |
Prerequisite: | lp:~cjwatson/launchpad/soyuz-tests-future-imports |
Diff against target: |
1478 lines (+330/-279) 26 files modified
lib/lp/archivepublisher/tests/__init__.py (+3/-1) lib/lp/archivepublisher/tests/test_archivesigningkey.py (+3/-1) lib/lp/archivepublisher/tests/test_config.py (+3/-1) lib/lp/archivepublisher/tests/test_customupload.py (+3/-1) lib/lp/archivepublisher/tests/test_ddtp_tarball.py (+10/-8) lib/lp/archivepublisher/tests/test_deathrow.py (+3/-1) lib/lp/archivepublisher/tests/test_debian_installer.py (+10/-8) lib/lp/archivepublisher/tests/test_debversion.py (+3/-1) lib/lp/archivepublisher/tests/test_dist_upgrader.py (+8/-6) lib/lp/archivepublisher/tests/test_dominator.py (+3/-1) lib/lp/archivepublisher/tests/test_ftparchive.py (+7/-5) lib/lp/archivepublisher/tests/test_generate_contents_files.py (+3/-1) lib/lp/archivepublisher/tests/test_generate_ppa_htaccess.py (+17/-15) lib/lp/archivepublisher/tests/test_htaccess.py (+7/-5) lib/lp/archivepublisher/tests/test_indices.py (+136/-134) lib/lp/archivepublisher/tests/test_pool.py (+3/-1) lib/lp/archivepublisher/tests/test_processaccepted.py (+4/-2) lib/lp/archivepublisher/tests/test_processdeathrow.py (+5/-3) lib/lp/archivepublisher/tests/test_publish_ftpmaster.py (+4/-2) lib/lp/archivepublisher/tests/test_publishdistro.py (+3/-1) lib/lp/archivepublisher/tests/test_publisher.py (+12/-10) lib/lp/archivepublisher/tests/test_publisher_documentation.py (+3/-1) lib/lp/archivepublisher/tests/test_publisherconfig.py (+10/-8) lib/lp/archivepublisher/tests/test_repositoryindexfile.py (+3/-1) lib/lp/archivepublisher/tests/test_rosetta_translations.py (+5/-3) lib/lp/archivepublisher/tests/test_signing.py (+59/-58) |
To merge this branch: | bzr merge lp:~cjwatson/launchpad/archivepublisher-tests-future-imports |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
William Grant | code | Approve | |
Review via email: mp+337053@code.launchpad.net |
Commit message
Convert lp.archivepubli
Description of the change
The contents of files in tarfiles need to remain as bytes, but everything else was easy.
To post a comment you must log in.
Revision history for this message
William Grant (wgrant) : | # |
review:
Approve
(code)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'lib/lp/archivepublisher/tests/__init__.py' | |||
2 | --- lib/lp/archivepublisher/tests/__init__.py 2010-08-20 20:31:18 +0000 | |||
3 | +++ lib/lp/archivepublisher/tests/__init__.py 2018-02-02 11:57:41 +0000 | |||
4 | @@ -1,6 +1,8 @@ | |||
6 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
7 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
8 | 3 | 3 | ||
9 | 4 | from __future__ import absolute_import, print_function, unicode_literals | ||
10 | 5 | |||
11 | 4 | import os | 6 | import os |
12 | 5 | 7 | ||
13 | 6 | 8 | ||
14 | 7 | 9 | ||
15 | === modified file 'lib/lp/archivepublisher/tests/test_archivesigningkey.py' | |||
16 | --- lib/lp/archivepublisher/tests/test_archivesigningkey.py 2017-04-29 15:24:32 +0000 | |||
17 | +++ lib/lp/archivepublisher/tests/test_archivesigningkey.py 2018-02-02 11:57:41 +0000 | |||
18 | @@ -1,8 +1,10 @@ | |||
20 | 1 | # Copyright 2016-2017 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2016-2018 Canonical Ltd. This software is licensed under the |
21 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
22 | 3 | 3 | ||
23 | 4 | """Test ArchiveSigningKey.""" | 4 | """Test ArchiveSigningKey.""" |
24 | 5 | 5 | ||
25 | 6 | from __future__ import absolute_import, print_function, unicode_literals | ||
26 | 7 | |||
27 | 6 | __metaclass__ = type | 8 | __metaclass__ = type |
28 | 7 | 9 | ||
29 | 8 | import os | 10 | import os |
30 | 9 | 11 | ||
31 | === modified file 'lib/lp/archivepublisher/tests/test_config.py' | |||
32 | --- lib/lp/archivepublisher/tests/test_config.py 2016-05-04 14:49:37 +0000 | |||
33 | +++ lib/lp/archivepublisher/tests/test_config.py 2018-02-02 11:57:41 +0000 | |||
34 | @@ -1,4 +1,4 @@ | |||
36 | 1 | # Copyright 2011-2016 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2011-2018 Canonical Ltd. This software is licensed under the |
37 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
38 | 3 | 3 | ||
39 | 4 | """Test publisher configs handling. | 4 | """Test publisher configs handling. |
40 | @@ -6,6 +6,8 @@ | |||
41 | 6 | Publisher configuration provides archive-dependent filesystem paths. | 6 | Publisher configuration provides archive-dependent filesystem paths. |
42 | 7 | """ | 7 | """ |
43 | 8 | 8 | ||
44 | 9 | from __future__ import absolute_import, print_function, unicode_literals | ||
45 | 10 | |||
46 | 9 | __metaclass__ = type | 11 | __metaclass__ = type |
47 | 10 | 12 | ||
48 | 11 | import os | 13 | import os |
49 | 12 | 14 | ||
50 | === modified file 'lib/lp/archivepublisher/tests/test_customupload.py' | |||
51 | --- lib/lp/archivepublisher/tests/test_customupload.py 2012-05-28 13:13:53 +0000 | |||
52 | +++ lib/lp/archivepublisher/tests/test_customupload.py 2018-02-02 11:57:41 +0000 | |||
53 | @@ -1,8 +1,10 @@ | |||
55 | 1 | # Copyright 2009-2012 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
56 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
57 | 3 | 3 | ||
58 | 4 | """Tests for `CustomUploads`.""" | 4 | """Tests for `CustomUploads`.""" |
59 | 5 | 5 | ||
60 | 6 | from __future__ import absolute_import, print_function, unicode_literals | ||
61 | 7 | |||
62 | 6 | __metaclass__ = type | 8 | __metaclass__ = type |
63 | 7 | 9 | ||
64 | 8 | 10 | ||
65 | 9 | 11 | ||
66 | === modified file 'lib/lp/archivepublisher/tests/test_ddtp_tarball.py' | |||
67 | --- lib/lp/archivepublisher/tests/test_ddtp_tarball.py 2016-06-07 17:07:35 +0000 | |||
68 | +++ lib/lp/archivepublisher/tests/test_ddtp_tarball.py 2018-02-02 11:57:41 +0000 | |||
69 | @@ -1,4 +1,4 @@ | |||
71 | 1 | # Copyright 2012-2016 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2012-2018 Canonical Ltd. This software is licensed under the |
72 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
73 | 3 | 3 | ||
74 | 4 | """Test ddtp-tarball custom uploads. | 4 | """Test ddtp-tarball custom uploads. |
75 | @@ -7,6 +7,8 @@ | |||
76 | 7 | tests of ddtp-tarball upload and queue manipulation. | 7 | tests of ddtp-tarball upload and queue manipulation. |
77 | 8 | """ | 8 | """ |
78 | 9 | 9 | ||
79 | 10 | from __future__ import absolute_import, print_function, unicode_literals | ||
80 | 11 | |||
81 | 10 | import os | 12 | import os |
82 | 11 | 13 | ||
83 | 12 | from zope.component import getUtility | 14 | from zope.component import getUtility |
84 | @@ -57,7 +59,7 @@ | |||
85 | 57 | def test_basic(self): | 59 | def test_basic(self): |
86 | 58 | # Processing a simple correct tar file works. | 60 | # Processing a simple correct tar file works. |
87 | 59 | self.openArchive("20060728") | 61 | self.openArchive("20060728") |
89 | 60 | self.tarfile.add_file("i18n/Translation-de", "") | 62 | self.tarfile.add_file("i18n/Translation-de", b"") |
90 | 61 | self.process() | 63 | self.process() |
91 | 62 | self.assertTrue(os.path.exists( | 64 | self.assertTrue(os.path.exists( |
92 | 63 | self.getTranslationsPath("Translation-de"))) | 65 | self.getTranslationsPath("Translation-de"))) |
93 | @@ -65,7 +67,7 @@ | |||
94 | 65 | def test_ignores_empty_directories(self): | 67 | def test_ignores_empty_directories(self): |
95 | 66 | # Empty directories in the tarball are not extracted. | 68 | # Empty directories in the tarball are not extracted. |
96 | 67 | self.openArchive("20060728") | 69 | self.openArchive("20060728") |
98 | 68 | self.tarfile.add_file("i18n/Translation-de", "") | 70 | self.tarfile.add_file("i18n/Translation-de", b"") |
99 | 69 | self.tarfile.add_directory("i18n/foo") | 71 | self.tarfile.add_directory("i18n/foo") |
100 | 70 | self.process() | 72 | self.process() |
101 | 71 | self.assertTrue(os.path.exists( | 73 | self.assertTrue(os.path.exists( |
102 | @@ -76,15 +78,15 @@ | |||
103 | 76 | # If a DDTP tarball only contains a subset of published translation | 78 | # If a DDTP tarball only contains a subset of published translation |
104 | 77 | # files, these are updated and the rest are left untouched. | 79 | # files, these are updated and the rest are left untouched. |
105 | 78 | self.openArchive("20060728") | 80 | self.openArchive("20060728") |
108 | 79 | self.tarfile.add_file("i18n/Translation-bn", "bn") | 81 | self.tarfile.add_file("i18n/Translation-bn", b"bn") |
109 | 80 | self.tarfile.add_file("i18n/Translation-ca", "ca") | 82 | self.tarfile.add_file("i18n/Translation-ca", b"ca") |
110 | 81 | self.process() | 83 | self.process() |
111 | 82 | with open(self.getTranslationsPath("Translation-bn")) as bn_file: | 84 | with open(self.getTranslationsPath("Translation-bn")) as bn_file: |
112 | 83 | self.assertEqual("bn", bn_file.read()) | 85 | self.assertEqual("bn", bn_file.read()) |
113 | 84 | with open(self.getTranslationsPath("Translation-ca")) as ca_file: | 86 | with open(self.getTranslationsPath("Translation-ca")) as ca_file: |
114 | 85 | self.assertEqual("ca", ca_file.read()) | 87 | self.assertEqual("ca", ca_file.read()) |
115 | 86 | self.openArchive("20060817") | 88 | self.openArchive("20060817") |
117 | 87 | self.tarfile.add_file("i18n/Translation-bn", "new bn") | 89 | self.tarfile.add_file("i18n/Translation-bn", b"new bn") |
118 | 88 | self.process() | 90 | self.process() |
119 | 89 | with open(self.getTranslationsPath("Translation-bn")) as bn_file: | 91 | with open(self.getTranslationsPath("Translation-bn")) as bn_file: |
120 | 90 | self.assertEqual("new bn", bn_file.read()) | 92 | self.assertEqual("new bn", bn_file.read()) |
121 | @@ -98,7 +100,7 @@ | |||
122 | 98 | # into place, so making this work requires special care. Test that | 100 | # into place, so making this work requires special care. Test that |
123 | 99 | # that care has been taken. | 101 | # that care has been taken. |
124 | 100 | self.openArchive("20060728") | 102 | self.openArchive("20060728") |
126 | 101 | self.tarfile.add_file("i18n/Translation-ca", "") | 103 | self.tarfile.add_file("i18n/Translation-ca", b"") |
127 | 102 | self.process() | 104 | self.process() |
128 | 103 | ca = self.getTranslationsPath("Translation-ca") | 105 | ca = self.getTranslationsPath("Translation-ca") |
129 | 104 | bn = self.getTranslationsPath("Translation-bn") | 106 | bn = self.getTranslationsPath("Translation-bn") |
130 | @@ -107,7 +109,7 @@ | |||
131 | 107 | self.assertEqual(2, os.stat(bn).st_nlink) | 109 | self.assertEqual(2, os.stat(bn).st_nlink) |
132 | 108 | self.assertEqual(2, os.stat(ca).st_nlink) | 110 | self.assertEqual(2, os.stat(ca).st_nlink) |
133 | 109 | self.openArchive("20060817") | 111 | self.openArchive("20060817") |
135 | 110 | self.tarfile.add_file("i18n/Translation-bn", "break hard link") | 112 | self.tarfile.add_file("i18n/Translation-bn", b"break hard link") |
136 | 111 | self.process() | 113 | self.process() |
137 | 112 | with open(bn) as bn_file: | 114 | with open(bn) as bn_file: |
138 | 113 | self.assertEqual("break hard link", bn_file.read()) | 115 | self.assertEqual("break hard link", bn_file.read()) |
139 | 114 | 116 | ||
140 | === modified file 'lib/lp/archivepublisher/tests/test_deathrow.py' | |||
141 | --- lib/lp/archivepublisher/tests/test_deathrow.py 2016-09-24 06:21:55 +0000 | |||
142 | +++ lib/lp/archivepublisher/tests/test_deathrow.py 2018-02-02 11:57:41 +0000 | |||
143 | @@ -1,8 +1,10 @@ | |||
145 | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
146 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
147 | 3 | 3 | ||
148 | 4 | """Tests for deathrow class.""" | 4 | """Tests for deathrow class.""" |
149 | 5 | 5 | ||
150 | 6 | from __future__ import absolute_import, print_function, unicode_literals | ||
151 | 7 | |||
152 | 6 | __metaclass__ = type | 8 | __metaclass__ = type |
153 | 7 | 9 | ||
154 | 8 | 10 | ||
155 | 9 | 11 | ||
156 | === modified file 'lib/lp/archivepublisher/tests/test_debian_installer.py' | |||
157 | --- lib/lp/archivepublisher/tests/test_debian_installer.py 2016-06-07 17:07:35 +0000 | |||
158 | +++ lib/lp/archivepublisher/tests/test_debian_installer.py 2018-02-02 11:57:41 +0000 | |||
159 | @@ -1,4 +1,4 @@ | |||
161 | 1 | # Copyright 2012-2016 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2012-2018 Canonical Ltd. This software is licensed under the |
162 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
163 | 3 | 3 | ||
164 | 4 | """Test debian-installer custom uploads. | 4 | """Test debian-installer custom uploads. |
165 | @@ -7,6 +7,8 @@ | |||
166 | 7 | high-level tests of debian-installer upload and queue manipulation. | 7 | high-level tests of debian-installer upload and queue manipulation. |
167 | 8 | """ | 8 | """ |
168 | 9 | 9 | ||
169 | 10 | from __future__ import absolute_import, print_function, unicode_literals | ||
170 | 11 | |||
171 | 10 | import os | 12 | import os |
172 | 11 | 13 | ||
173 | 12 | from zope.component import getUtility | 14 | from zope.component import getUtility |
174 | @@ -77,7 +79,7 @@ | |||
175 | 77 | def test_basic(self): | 79 | def test_basic(self): |
176 | 78 | # Processing a simple correct tar file succeeds. | 80 | # Processing a simple correct tar file succeeds. |
177 | 79 | self.openArchive() | 81 | self.openArchive() |
179 | 80 | self.addFile("hello", "world") | 82 | self.addFile("hello", b"world") |
180 | 81 | self.process() | 83 | self.process() |
181 | 82 | 84 | ||
182 | 83 | def test_already_exists(self): | 85 | def test_already_exists(self): |
183 | @@ -89,14 +91,14 @@ | |||
184 | 89 | def test_bad_umask(self): | 91 | def test_bad_umask(self): |
185 | 90 | # The umask must be 0o022 to avoid incorrect permissions. | 92 | # The umask must be 0o022 to avoid incorrect permissions. |
186 | 91 | self.openArchive() | 93 | self.openArchive() |
188 | 92 | self.addFile("dir/file", "foo") | 94 | self.addFile("dir/file", b"foo") |
189 | 93 | os.umask(0o002) # cleanup already handled by setUp | 95 | os.umask(0o002) # cleanup already handled by setUp |
190 | 94 | self.assertRaises(CustomUploadBadUmask, self.process) | 96 | self.assertRaises(CustomUploadBadUmask, self.process) |
191 | 95 | 97 | ||
192 | 96 | def test_current_symlink(self): | 98 | def test_current_symlink(self): |
193 | 97 | # A "current" symlink is created to the last version. | 99 | # A "current" symlink is created to the last version. |
194 | 98 | self.openArchive() | 100 | self.openArchive() |
196 | 99 | self.addFile("hello", "world") | 101 | self.addFile("hello", b"world") |
197 | 100 | self.process() | 102 | self.process() |
198 | 101 | installer_path = self.getInstallerPath() | 103 | installer_path = self.getInstallerPath() |
199 | 102 | self.assertContentEqual( | 104 | self.assertContentEqual( |
200 | @@ -112,8 +114,8 @@ | |||
201 | 112 | filename = os.path.join(directory, "default") | 114 | filename = os.path.join(directory, "default") |
202 | 113 | long_filename = os.path.join( | 115 | long_filename = os.path.join( |
203 | 114 | directory, "very_very_very_very_very_very_long_filename") | 116 | directory, "very_very_very_very_very_very_long_filename") |
206 | 115 | self.addFile(filename, "hey") | 117 | self.addFile(filename, b"hey") |
207 | 116 | self.addFile(long_filename, "long") | 118 | self.addFile(long_filename, b"long") |
208 | 117 | self.process() | 119 | self.process() |
209 | 118 | with open(self.getInstallerPath(filename)) as f: | 120 | with open(self.getInstallerPath(filename)) as f: |
210 | 119 | self.assertEqual("hey", f.read()) | 121 | self.assertEqual("hey", f.read()) |
211 | @@ -140,7 +142,7 @@ | |||
212 | 140 | def test_top_level_permissions(self): | 142 | def test_top_level_permissions(self): |
213 | 141 | # Top-level directories are set to mode 0o755 (see bug 107068). | 143 | # Top-level directories are set to mode 0o755 (see bug 107068). |
214 | 142 | self.openArchive() | 144 | self.openArchive() |
216 | 143 | self.addFile("hello", "world") | 145 | self.addFile("hello", b"world") |
217 | 144 | self.process() | 146 | self.process() |
218 | 145 | installer_path = self.getInstallerPath() | 147 | installer_path = self.getInstallerPath() |
219 | 146 | self.assertEqual(0o755, os.stat(installer_path).st_mode & 0o777) | 148 | self.assertEqual(0o755, os.stat(installer_path).st_mode & 0o777) |
220 | @@ -154,7 +156,7 @@ | |||
221 | 154 | directory = ("images/netboot/ubuntu-installer/i386/" | 156 | directory = ("images/netboot/ubuntu-installer/i386/" |
222 | 155 | "pxelinux.cfg.serial-9600") | 157 | "pxelinux.cfg.serial-9600") |
223 | 156 | filename = os.path.join(directory, "default") | 158 | filename = os.path.join(directory, "default") |
225 | 157 | self.addFile(filename, "hey") | 159 | self.addFile(filename, b"hey") |
226 | 158 | self.process() | 160 | self.process() |
227 | 159 | self.assertEqual( | 161 | self.assertEqual( |
228 | 160 | 0o644, os.stat(self.getInstallerPath(filename)).st_mode & 0o777) | 162 | 0o644, os.stat(self.getInstallerPath(filename)).st_mode & 0o777) |
229 | 161 | 163 | ||
230 | === modified file 'lib/lp/archivepublisher/tests/test_debversion.py' | |||
231 | --- lib/lp/archivepublisher/tests/test_debversion.py 2018-01-02 16:10:26 +0000 | |||
232 | +++ lib/lp/archivepublisher/tests/test_debversion.py 2018-02-02 11:57:41 +0000 | |||
233 | @@ -1,8 +1,10 @@ | |||
235 | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
236 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
237 | 3 | 3 | ||
238 | 4 | """Tests for debversion.""" | 4 | """Tests for debversion.""" |
239 | 5 | 5 | ||
240 | 6 | from __future__ import absolute_import, print_function, unicode_literals | ||
241 | 7 | |||
242 | 6 | __metaclass__ = type | 8 | __metaclass__ = type |
243 | 7 | 9 | ||
244 | 8 | # These tests came from sourcerer. | 10 | # These tests came from sourcerer. |
245 | 9 | 11 | ||
246 | === modified file 'lib/lp/archivepublisher/tests/test_dist_upgrader.py' | |||
247 | --- lib/lp/archivepublisher/tests/test_dist_upgrader.py 2016-06-07 17:07:35 +0000 | |||
248 | +++ lib/lp/archivepublisher/tests/test_dist_upgrader.py 2018-02-02 11:57:41 +0000 | |||
249 | @@ -1,4 +1,4 @@ | |||
251 | 1 | # Copyright 2012-2016 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2012-2018 Canonical Ltd. This software is licensed under the |
252 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
253 | 3 | 3 | ||
254 | 4 | """Test dist-upgrader custom uploads. | 4 | """Test dist-upgrader custom uploads. |
255 | @@ -7,6 +7,8 @@ | |||
256 | 7 | tests of dist-upgrader upload and queue manipulation. | 7 | tests of dist-upgrader upload and queue manipulation. |
257 | 8 | """ | 8 | """ |
258 | 9 | 9 | ||
259 | 10 | from __future__ import absolute_import, print_function, unicode_literals | ||
260 | 11 | |||
261 | 10 | import os | 12 | import os |
262 | 11 | 13 | ||
263 | 12 | from zope.component import getUtility | 14 | from zope.component import getUtility |
264 | @@ -71,27 +73,27 @@ | |||
265 | 71 | def test_basic(self): | 73 | def test_basic(self): |
266 | 72 | # Processing a simple correct tar file works. | 74 | # Processing a simple correct tar file works. |
267 | 73 | self.openArchive("20060302.0120") | 75 | self.openArchive("20060302.0120") |
269 | 74 | self.tarfile.add_file("20060302.0120/hello", "world") | 76 | self.tarfile.add_file("20060302.0120/hello", b"world") |
270 | 75 | self.process() | 77 | self.process() |
271 | 76 | 78 | ||
272 | 77 | def test_already_exists(self): | 79 | def test_already_exists(self): |
273 | 78 | # If the target directory already exists, processing fails. | 80 | # If the target directory already exists, processing fails. |
274 | 79 | self.openArchive("20060302.0120") | 81 | self.openArchive("20060302.0120") |
276 | 80 | self.tarfile.add_file("20060302.0120/hello", "world") | 82 | self.tarfile.add_file("20060302.0120/hello", b"world") |
277 | 81 | os.makedirs(os.path.join(self.getUpgraderPath(), "20060302.0120")) | 83 | os.makedirs(os.path.join(self.getUpgraderPath(), "20060302.0120")) |
278 | 82 | self.assertRaises(CustomUploadAlreadyExists, self.process) | 84 | self.assertRaises(CustomUploadAlreadyExists, self.process) |
279 | 83 | 85 | ||
280 | 84 | def test_bad_umask(self): | 86 | def test_bad_umask(self): |
281 | 85 | # The umask must be 0o022 to avoid incorrect permissions. | 87 | # The umask must be 0o022 to avoid incorrect permissions. |
282 | 86 | self.openArchive("20060302.0120") | 88 | self.openArchive("20060302.0120") |
284 | 87 | self.tarfile.add_file("20060302.0120/file", "foo") | 89 | self.tarfile.add_file("20060302.0120/file", b"foo") |
285 | 88 | os.umask(0o002) # cleanup already handled by setUp | 90 | os.umask(0o002) # cleanup already handled by setUp |
286 | 89 | self.assertRaises(CustomUploadBadUmask, self.process) | 91 | self.assertRaises(CustomUploadBadUmask, self.process) |
287 | 90 | 92 | ||
288 | 91 | def test_current_symlink(self): | 93 | def test_current_symlink(self): |
289 | 92 | # A "current" symlink is created to the last version. | 94 | # A "current" symlink is created to the last version. |
290 | 93 | self.openArchive("20060302.0120") | 95 | self.openArchive("20060302.0120") |
292 | 94 | self.tarfile.add_file("20060302.0120/hello", "world") | 96 | self.tarfile.add_file("20060302.0120/hello", b"world") |
293 | 95 | self.process() | 97 | self.process() |
294 | 96 | upgrader_path = self.getUpgraderPath() | 98 | upgrader_path = self.getUpgraderPath() |
295 | 97 | self.assertContentEqual( | 99 | self.assertContentEqual( |
296 | @@ -106,7 +108,7 @@ | |||
297 | 106 | def test_bad_version(self): | 108 | def test_bad_version(self): |
298 | 107 | # Bad versions in the tarball are refused. | 109 | # Bad versions in the tarball are refused. |
299 | 108 | self.openArchive("20070219.1234") | 110 | self.openArchive("20070219.1234") |
301 | 109 | self.tarfile.add_file("foobar/foobar/dapper.tar.gz", "") | 111 | self.tarfile.add_file("foobar/foobar/dapper.tar.gz", b"") |
302 | 110 | self.assertRaises(DistUpgraderBadVersion, self.process) | 112 | self.assertRaises(DistUpgraderBadVersion, self.process) |
303 | 111 | 113 | ||
304 | 112 | def test_getSeriesKey_extracts_architecture(self): | 114 | def test_getSeriesKey_extracts_architecture(self): |
305 | 113 | 115 | ||
306 | === modified file 'lib/lp/archivepublisher/tests/test_dominator.py' | |||
307 | --- lib/lp/archivepublisher/tests/test_dominator.py 2014-10-31 10:34:51 +0000 | |||
308 | +++ lib/lp/archivepublisher/tests/test_dominator.py 2018-02-02 11:57:41 +0000 | |||
309 | @@ -1,8 +1,10 @@ | |||
311 | 1 | # Copyright 2009-2011 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
312 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
313 | 3 | 3 | ||
314 | 4 | """Tests for domination.py.""" | 4 | """Tests for domination.py.""" |
315 | 5 | 5 | ||
316 | 6 | from __future__ import absolute_import, print_function, unicode_literals | ||
317 | 7 | |||
318 | 6 | __metaclass__ = type | 8 | __metaclass__ = type |
319 | 7 | 9 | ||
320 | 8 | import datetime | 10 | import datetime |
321 | 9 | 11 | ||
322 | === modified file 'lib/lp/archivepublisher/tests/test_ftparchive.py' | |||
323 | --- lib/lp/archivepublisher/tests/test_ftparchive.py 2017-01-13 12:28:34 +0000 | |||
324 | +++ lib/lp/archivepublisher/tests/test_ftparchive.py 2018-02-02 11:57:41 +0000 | |||
325 | @@ -1,8 +1,10 @@ | |||
327 | 1 | # Copyright 2009-2017 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
328 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
329 | 3 | 3 | ||
330 | 4 | """Tests for ftparchive.py""" | 4 | """Tests for ftparchive.py""" |
331 | 5 | 5 | ||
332 | 6 | from __future__ import absolute_import, print_function, unicode_literals | ||
333 | 7 | |||
334 | 6 | __metaclass__ = type | 8 | __metaclass__ = type |
335 | 7 | 9 | ||
336 | 8 | import difflib | 10 | import difflib |
337 | @@ -254,7 +256,7 @@ | |||
338 | 254 | extra_overrides = os.path.join( | 256 | extra_overrides = os.path.join( |
339 | 255 | self._confdir, "more-extra.override.hoary-test.main") | 257 | self._confdir, "more-extra.override.hoary-test.main") |
340 | 256 | with open(extra_overrides, "w") as extra_override_file: | 258 | with open(extra_overrides, "w") as extra_override_file: |
342 | 257 | print >>extra_override_file, " ".join(sentinel) | 259 | print(" ".join(sentinel), file=extra_override_file) |
343 | 258 | self._publishDefaultOverrides(fa, 'universe') | 260 | self._publishDefaultOverrides(fa, 'universe') |
344 | 259 | 261 | ||
345 | 260 | result_path = os.path.join( | 262 | result_path = os.path.join( |
346 | @@ -332,7 +334,7 @@ | |||
347 | 332 | self._publisher = SamplePublisher(self._archive) | 334 | self._publisher = SamplePublisher(self._archive) |
348 | 333 | fa = self._setUpFTPArchiveHandler() | 335 | fa = self._setUpFTPArchiveHandler() |
349 | 334 | pubs = self._archive.getAllPublishedBinaries( | 336 | pubs = self._archive.getAllPublishedBinaries( |
351 | 335 | name=u"pmount", status=PackagePublishingStatus.PUBLISHED, | 337 | name="pmount", status=PackagePublishingStatus.PUBLISHED, |
352 | 336 | distroarchseries=self._distribution.getSeries("hoary")["hppa"]) | 338 | distroarchseries=self._distribution.getSeries("hoary")["hppa"]) |
353 | 337 | for pub in pubs: | 339 | for pub in pubs: |
354 | 338 | pub.changeOverride(new_phased_update_percentage=30).setPublished() | 340 | pub.changeOverride(new_phased_update_percentage=30).setPublished() |
355 | @@ -377,10 +379,10 @@ | |||
356 | 377 | 379 | ||
357 | 378 | def makeDDEBPub(self, series): | 380 | def makeDDEBPub(self, series): |
358 | 379 | self.factory.makeBinaryPackagePublishingHistory( | 381 | self.factory.makeBinaryPackagePublishingHistory( |
360 | 380 | binarypackagename=u'foo', sourcepackagename='foo', version='666', | 382 | binarypackagename='foo', sourcepackagename='foo', version='666', |
361 | 381 | archive=series.main_archive, distroarchseries=series['hppa'], | 383 | archive=series.main_archive, distroarchseries=series['hppa'], |
362 | 382 | pocket=PackagePublishingPocket.RELEASE, | 384 | pocket=PackagePublishingPocket.RELEASE, |
364 | 383 | component=u'main', with_debug=True, with_file=True, | 385 | component='main', with_debug=True, with_file=True, |
365 | 384 | status=PackagePublishingStatus.PUBLISHED, | 386 | status=PackagePublishingStatus.PUBLISHED, |
366 | 385 | architecturespecific=True) | 387 | architecturespecific=True) |
367 | 386 | 388 | ||
368 | 387 | 389 | ||
369 | === modified file 'lib/lp/archivepublisher/tests/test_generate_contents_files.py' | |||
370 | --- lib/lp/archivepublisher/tests/test_generate_contents_files.py 2016-11-01 10:28:15 +0000 | |||
371 | +++ lib/lp/archivepublisher/tests/test_generate_contents_files.py 2018-02-02 11:57:41 +0000 | |||
372 | @@ -1,8 +1,10 @@ | |||
374 | 1 | # Copyright 2011-2016 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2011-2018 Canonical Ltd. This software is licensed under the |
375 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
376 | 3 | 3 | ||
377 | 4 | """Test for the `generate-contents-files` script.""" | 4 | """Test for the `generate-contents-files` script.""" |
378 | 5 | 5 | ||
379 | 6 | from __future__ import absolute_import, print_function, unicode_literals | ||
380 | 7 | |||
381 | 6 | __metaclass__ = type | 8 | __metaclass__ = type |
382 | 7 | 9 | ||
383 | 8 | import hashlib | 10 | import hashlib |
384 | 9 | 11 | ||
385 | === modified file 'lib/lp/archivepublisher/tests/test_generate_ppa_htaccess.py' | |||
386 | --- lib/lp/archivepublisher/tests/test_generate_ppa_htaccess.py 2016-07-14 14:12:23 +0000 | |||
387 | +++ lib/lp/archivepublisher/tests/test_generate_ppa_htaccess.py 2018-02-02 11:57:41 +0000 | |||
388 | @@ -1,8 +1,10 @@ | |||
390 | 1 | # Copyright 2009-2015 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
391 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
392 | 3 | 3 | ||
393 | 4 | """Test the generate_ppa_htaccess.py script. """ | 4 | """Test the generate_ppa_htaccess.py script. """ |
394 | 5 | 5 | ||
395 | 6 | from __future__ import absolute_import, print_function, unicode_literals | ||
396 | 7 | |||
397 | 6 | import crypt | 8 | import crypt |
398 | 7 | from datetime import ( | 9 | from datetime import ( |
399 | 8 | datetime, | 10 | datetime, |
400 | @@ -75,7 +77,7 @@ | |||
401 | 75 | self.ppa.distribution = ubuntutest | 77 | self.ppa.distribution = ubuntutest |
402 | 76 | 78 | ||
403 | 77 | # Enable named auth tokens. | 79 | # Enable named auth tokens. |
405 | 78 | self.useFixture(FeatureFixture({NAMED_AUTH_TOKEN_FEATURE_FLAG: u"on"})) | 80 | self.useFixture(FeatureFixture({NAMED_AUTH_TOKEN_FEATURE_FLAG: "on"})) |
406 | 79 | 81 | ||
407 | 80 | def getScript(self, test_args=None): | 82 | def getScript(self, test_args=None): |
408 | 81 | """Return a HtaccessTokenGenerator instance.""" | 83 | """Return a HtaccessTokenGenerator instance.""" |
409 | @@ -266,8 +268,8 @@ | |||
410 | 266 | team1_person = persons1[0] | 268 | team1_person = persons1[0] |
411 | 267 | 269 | ||
412 | 268 | # Named tokens should be ignored for deactivation. | 270 | # Named tokens should be ignored for deactivation. |
415 | 269 | self.ppa.newNamedAuthToken(u"tokenname1") | 271 | self.ppa.newNamedAuthToken("tokenname1") |
416 | 270 | named_token = self.ppa.newNamedAuthToken(u"tokenname2") | 272 | named_token = self.ppa.newNamedAuthToken("tokenname2") |
417 | 271 | named_token.deactivate() | 273 | named_token.deactivate() |
418 | 272 | 274 | ||
419 | 273 | # Initially, nothing is eligible for deactivation. | 275 | # Initially, nothing is eligible for deactivation. |
420 | @@ -335,7 +337,7 @@ | |||
421 | 335 | sub2 = self.ppa.newSubscription(name16, self.ppa.owner) | 337 | sub2 = self.ppa.newSubscription(name16, self.ppa.owner) |
422 | 336 | token1 = self.ppa.newAuthToken(name12) | 338 | token1 = self.ppa.newAuthToken(name12) |
423 | 337 | token2 = self.ppa.newAuthToken(name16) | 339 | token2 = self.ppa.newAuthToken(name16) |
425 | 338 | token3 = self.ppa.newNamedAuthToken(u"tokenname3") | 340 | token3 = self.ppa.newNamedAuthToken("tokenname3") |
426 | 339 | self.layer.txn.commit() | 341 | self.layer.txn.commit() |
427 | 340 | return (sub1, sub2), (token1, token2, token3) | 342 | return (sub1, sub2), (token1, token2, token3) |
428 | 341 | 343 | ||
429 | @@ -384,9 +386,9 @@ | |||
430 | 384 | 386 | ||
431 | 385 | def testBasicOperation_with_named_tokens(self): | 387 | def testBasicOperation_with_named_tokens(self): |
432 | 386 | """Invoke the actual script and make sure it generates some files.""" | 388 | """Invoke the actual script and make sure it generates some files.""" |
436 | 387 | token1 = self.ppa.newNamedAuthToken(u"tokenname1") | 389 | token1 = self.ppa.newNamedAuthToken("tokenname1") |
437 | 388 | token2 = self.ppa.newNamedAuthToken(u"tokenname2") | 390 | token2 = self.ppa.newNamedAuthToken("tokenname2") |
438 | 389 | token3 = self.ppa.newNamedAuthToken(u"tokenname3") | 391 | token3 = self.ppa.newNamedAuthToken("tokenname3") |
439 | 390 | token3.deactivate() | 392 | token3.deactivate() |
440 | 391 | 393 | ||
441 | 392 | # Call the script and check that we have a .htaccess and a .htpasswd. | 394 | # Call the script and check that we have a .htaccess and a .htpasswd. |
442 | @@ -641,10 +643,10 @@ | |||
443 | 641 | last_start = datetime.now(pytz.UTC) - timedelta(seconds=90) | 643 | last_start = datetime.now(pytz.UTC) - timedelta(seconds=90) |
444 | 642 | before_last_start = last_start - timedelta(seconds=30) | 644 | before_last_start = last_start - timedelta(seconds=30) |
445 | 643 | 645 | ||
448 | 644 | self.ppa.newNamedAuthToken(u"tokenname1") | 646 | self.ppa.newNamedAuthToken("tokenname1") |
449 | 645 | token2 = self.ppa.newNamedAuthToken(u"tokenname2") | 647 | token2 = self.ppa.newNamedAuthToken("tokenname2") |
450 | 646 | token2.deactivate() | 648 | token2.deactivate() |
452 | 647 | token3 = self.ppa.newNamedAuthToken(u"tokenname3") | 649 | token3 = self.ppa.newNamedAuthToken("tokenname3") |
453 | 648 | token3.date_deactivated = before_last_start | 650 | token3.date_deactivated = before_last_start |
454 | 649 | 651 | ||
455 | 650 | script = self.getScript() | 652 | script = self.getScript() |
456 | @@ -657,12 +659,12 @@ | |||
457 | 657 | before_last_start = last_start - timedelta(seconds=30) | 659 | before_last_start = last_start - timedelta(seconds=30) |
458 | 658 | tomorrow = datetime.now(pytz.UTC) + timedelta(days=1) | 660 | tomorrow = datetime.now(pytz.UTC) + timedelta(days=1) |
459 | 659 | 661 | ||
462 | 660 | self.ppa.newNamedAuthToken(u"tokenname1") | 662 | self.ppa.newNamedAuthToken("tokenname1") |
463 | 661 | token2 = self.ppa.newNamedAuthToken(u"tokenname2") | 663 | token2 = self.ppa.newNamedAuthToken("tokenname2") |
464 | 662 | token2.deactivate() | 664 | token2.deactivate() |
466 | 663 | token3 = self.ppa.newNamedAuthToken(u"tokenname3") | 665 | token3 = self.ppa.newNamedAuthToken("tokenname3") |
467 | 664 | token3.date_deactivated = before_last_start | 666 | token3.date_deactivated = before_last_start |
469 | 665 | token4 = self.ppa.newNamedAuthToken(u"tokenname4") | 667 | token4 = self.ppa.newNamedAuthToken("tokenname4") |
470 | 666 | token4.date_deactivated = tomorrow | 668 | token4.date_deactivated = tomorrow |
471 | 667 | 669 | ||
472 | 668 | script = self.getScript() | 670 | script = self.getScript() |
473 | 669 | 671 | ||
474 | === modified file 'lib/lp/archivepublisher/tests/test_htaccess.py' | |||
475 | --- lib/lp/archivepublisher/tests/test_htaccess.py 2018-01-02 16:10:26 +0000 | |||
476 | +++ lib/lp/archivepublisher/tests/test_htaccess.py 2018-02-02 11:57:41 +0000 | |||
477 | @@ -1,8 +1,10 @@ | |||
479 | 1 | # Copyright 2009-2017 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
480 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
481 | 3 | 3 | ||
482 | 4 | """Test htaccess/htpasswd file generation. """ | 4 | """Test htaccess/htpasswd file generation. """ |
483 | 5 | 5 | ||
484 | 6 | from __future__ import absolute_import, print_function, unicode_literals | ||
485 | 7 | |||
486 | 6 | import os | 8 | import os |
487 | 7 | import tempfile | 9 | import tempfile |
488 | 8 | 10 | ||
489 | @@ -39,7 +41,7 @@ | |||
490 | 39 | self.ppa.distribution = ubuntutest | 41 | self.ppa.distribution = ubuntutest |
491 | 40 | 42 | ||
492 | 41 | # Enable named auth tokens. | 43 | # Enable named auth tokens. |
494 | 42 | self.useFixture(FeatureFixture({NAMED_AUTH_TOKEN_FEATURE_FLAG: u"on"})) | 44 | self.useFixture(FeatureFixture({NAMED_AUTH_TOKEN_FEATURE_FLAG: "on"})) |
495 | 43 | 45 | ||
496 | 44 | def test_write_htpasswd(self): | 46 | def test_write_htpasswd(self): |
497 | 45 | """Test that writing the .htpasswd file works properly.""" | 47 | """Test that writing the .htpasswd file works properly.""" |
498 | @@ -118,9 +120,9 @@ | |||
499 | 118 | first_created_token = self.ppa.newAuthToken(name16) | 120 | first_created_token = self.ppa.newAuthToken(name16) |
500 | 119 | second_created_token = self.ppa.newAuthToken(name12) | 121 | second_created_token = self.ppa.newAuthToken(name12) |
501 | 120 | third_created_token = self.ppa.newAuthToken(hyphenated) | 122 | third_created_token = self.ppa.newAuthToken(hyphenated) |
505 | 121 | named_token_20 = self.ppa.newNamedAuthToken(u"name20", as_dict=False) | 123 | named_token_20 = self.ppa.newNamedAuthToken("name20", as_dict=False) |
506 | 122 | named_token_14 = self.ppa.newNamedAuthToken(u"name14", as_dict=False) | 124 | named_token_14 = self.ppa.newNamedAuthToken("name14", as_dict=False) |
507 | 123 | named_token_99 = self.ppa.newNamedAuthToken(u"name99", as_dict=False) | 125 | named_token_99 = self.ppa.newNamedAuthToken("name99", as_dict=False) |
508 | 124 | named_token_99.deactivate() | 126 | named_token_99.deactivate() |
509 | 125 | 127 | ||
510 | 126 | expected_credentials = [ | 128 | expected_credentials = [ |
511 | 127 | 129 | ||
512 | === modified file 'lib/lp/archivepublisher/tests/test_indices.py' | |||
513 | --- lib/lp/archivepublisher/tests/test_indices.py 2016-02-05 15:16:29 +0000 | |||
514 | +++ lib/lp/archivepublisher/tests/test_indices.py 2018-02-02 11:57:41 +0000 | |||
515 | @@ -1,8 +1,10 @@ | |||
517 | 1 | # Copyright 2009-2013 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
518 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
519 | 3 | 3 | ||
520 | 4 | """Test native archive index generation for Soyuz.""" | 4 | """Test native archive index generation for Soyuz.""" |
521 | 5 | 5 | ||
522 | 6 | from __future__ import absolute_import, print_function, unicode_literals | ||
523 | 7 | |||
524 | 6 | import os | 8 | import os |
525 | 7 | import tempfile | 9 | import tempfile |
526 | 8 | import unittest | 10 | import unittest |
527 | @@ -70,27 +72,27 @@ | |||
528 | 70 | ("Build-Conflicts-Arch", "libbar-dev")]) | 72 | ("Build-Conflicts-Arch", "libbar-dev")]) |
529 | 71 | 73 | ||
530 | 72 | self.assertEqual( | 74 | self.assertEqual( |
552 | 73 | [u'Package: foo', | 75 | ['Package: foo', |
553 | 74 | u'Binary: foo-bin', | 76 | 'Binary: foo-bin', |
554 | 75 | u'Version: 666', | 77 | 'Version: 666', |
555 | 76 | u'Section: base', | 78 | 'Section: base', |
556 | 77 | u'Maintainer: Foo Bar <foo@bar.com>', | 79 | 'Maintainer: Foo Bar <foo@bar.com>', |
557 | 78 | u'Build-Depends: fooish', | 80 | 'Build-Depends: fooish', |
558 | 79 | u'Build-Depends-Indep: pyfoo', | 81 | 'Build-Depends-Indep: pyfoo', |
559 | 80 | u'Build-Depends-Arch: libfoo-dev', | 82 | 'Build-Depends-Arch: libfoo-dev', |
560 | 81 | u'Build-Conflicts: bar', | 83 | 'Build-Conflicts: bar', |
561 | 82 | u'Build-Conflicts-Indep: pybar', | 84 | 'Build-Conflicts-Indep: pybar', |
562 | 83 | u'Build-Conflicts-Arch: libbar-dev', | 85 | 'Build-Conflicts-Arch: libbar-dev', |
563 | 84 | u'Architecture: all', | 86 | 'Architecture: all', |
564 | 85 | u'Standards-Version: 3.6.2', | 87 | 'Standards-Version: 3.6.2', |
565 | 86 | u'Format: 1.0', | 88 | 'Format: 1.0', |
566 | 87 | u'Directory: pool/main/f/foo', | 89 | 'Directory: pool/main/f/foo', |
567 | 88 | u'Files:', | 90 | 'Files:', |
568 | 89 | u' %s 28 foo_666.dsc' % self.dsc_md5, | 91 | ' %s 28 foo_666.dsc' % self.dsc_md5, |
569 | 90 | u'Checksums-Sha1:', | 92 | 'Checksums-Sha1:', |
570 | 91 | u' %s 28 foo_666.dsc' % self.dsc_sha1, | 93 | ' %s 28 foo_666.dsc' % self.dsc_sha1, |
571 | 92 | u'Checksums-Sha256:', | 94 | 'Checksums-Sha256:', |
572 | 93 | u' %s 28 foo_666.dsc' % self.dsc_sha256, | 95 | ' %s 28 foo_666.dsc' % self.dsc_sha256, |
573 | 94 | ], | 96 | ], |
574 | 95 | build_spph_stanza(pub_source).makeOutput().splitlines()) | 97 | build_spph_stanza(pub_source).makeOutput().splitlines()) |
575 | 96 | 98 | ||
576 | @@ -112,28 +114,28 @@ | |||
577 | 112 | ("Build-Conflicts-Arch", "libbar-dev")]) | 114 | ("Build-Conflicts-Arch", "libbar-dev")]) |
578 | 113 | 115 | ||
579 | 114 | self.assertEqual( | 116 | self.assertEqual( |
602 | 115 | [u'Package: foo', | 117 | ['Package: foo', |
603 | 116 | u'Binary: foo-bin', | 118 | 'Binary: foo-bin', |
604 | 117 | u'Version: 666', | 119 | 'Version: 666', |
605 | 118 | u'Section: base', | 120 | 'Section: base', |
606 | 119 | u'Maintainer: Foo Bar <foo@bar.com>', | 121 | 'Maintainer: Foo Bar <foo@bar.com>', |
607 | 120 | u'Build-Depends: fooish', | 122 | 'Build-Depends: fooish', |
608 | 121 | u'Build-Depends-Indep: pyfoo', | 123 | 'Build-Depends-Indep: pyfoo', |
609 | 122 | u'Build-Depends-Arch: libfoo-dev', | 124 | 'Build-Depends-Arch: libfoo-dev', |
610 | 123 | u'Build-Conflicts: bar', | 125 | 'Build-Conflicts: bar', |
611 | 124 | u'Build-Conflicts-Indep: pybar', | 126 | 'Build-Conflicts-Indep: pybar', |
612 | 125 | u'Build-Conflicts-Arch: libbar-dev', | 127 | 'Build-Conflicts-Arch: libbar-dev', |
613 | 126 | u'Architecture: all', | 128 | 'Architecture: all', |
614 | 127 | u'Standards-Version: 3.6.2', | 129 | 'Standards-Version: 3.6.2', |
615 | 128 | u'Format: 1.0', | 130 | 'Format: 1.0', |
616 | 129 | u'Directory: pool/main/f/foo', | 131 | 'Directory: pool/main/f/foo', |
617 | 130 | u'Files:', | 132 | 'Files:', |
618 | 131 | u' %s 28 foo_666.dsc' % self.dsc_md5, | 133 | ' %s 28 foo_666.dsc' % self.dsc_md5, |
619 | 132 | u'Checksums-Sha1:', | 134 | 'Checksums-Sha1:', |
620 | 133 | u' %s 28 foo_666.dsc' % self.dsc_sha1, | 135 | ' %s 28 foo_666.dsc' % self.dsc_sha1, |
621 | 134 | u'Checksums-Sha256:', | 136 | 'Checksums-Sha256:', |
622 | 135 | u' %s 28 foo_666.dsc' % self.dsc_sha256, | 137 | ' %s 28 foo_666.dsc' % self.dsc_sha256, |
623 | 136 | u'Python-Version: < 1.5'], | 138 | 'Python-Version: < 1.5'], |
624 | 137 | build_spph_stanza(pub_source).makeOutput().splitlines()) | 139 | build_spph_stanza(pub_source).makeOutput().splitlines()) |
625 | 138 | 140 | ||
626 | 139 | def testBinaryStanza(self): | 141 | def testBinaryStanza(self): |
627 | @@ -149,32 +151,32 @@ | |||
628 | 149 | phased_update_percentage=50) | 151 | phased_update_percentage=50) |
629 | 150 | pub_binary = pub_binaries[0] | 152 | pub_binary = pub_binaries[0] |
630 | 151 | self.assertEqual( | 153 | self.assertEqual( |
657 | 152 | [u'Package: foo-bin', | 154 | ['Package: foo-bin', |
658 | 153 | u'Source: foo', | 155 | 'Source: foo', |
659 | 154 | u'Priority: standard', | 156 | 'Priority: standard', |
660 | 155 | u'Section: base', | 157 | 'Section: base', |
661 | 156 | u'Installed-Size: 100', | 158 | 'Installed-Size: 100', |
662 | 157 | u'Maintainer: Foo Bar <foo@bar.com>', | 159 | 'Maintainer: Foo Bar <foo@bar.com>', |
663 | 158 | u'Architecture: all', | 160 | 'Architecture: all', |
664 | 159 | u'Version: 666', | 161 | 'Version: 666', |
665 | 160 | u'Recommends: foo-dev', | 162 | 'Recommends: foo-dev', |
666 | 161 | u'Replaces: old-foo', | 163 | 'Replaces: old-foo', |
667 | 162 | u'Suggests: pyfoo', | 164 | 'Suggests: pyfoo', |
668 | 163 | u'Provides: foo-master', | 165 | 'Provides: foo-master', |
669 | 164 | u'Depends: biscuit', | 166 | 'Depends: biscuit', |
670 | 165 | u'Conflicts: old-foo', | 167 | 'Conflicts: old-foo', |
671 | 166 | u'Pre-Depends: master-foo', | 168 | 'Pre-Depends: master-foo', |
672 | 167 | u'Enhances: foo-super', | 169 | 'Enhances: foo-super', |
673 | 168 | u'Breaks: old-foo', | 170 | 'Breaks: old-foo', |
674 | 169 | u'Filename: pool/main/f/foo/foo-bin_666_all.deb', | 171 | 'Filename: pool/main/f/foo/foo-bin_666_all.deb', |
675 | 170 | u'Size: 18', | 172 | 'Size: 18', |
676 | 171 | u'MD5sum: ' + self.deb_md5, | 173 | 'MD5sum: ' + self.deb_md5, |
677 | 172 | u'SHA1: ' + self.deb_sha1, | 174 | 'SHA1: ' + self.deb_sha1, |
678 | 173 | u'SHA256: ' + self.deb_sha256, | 175 | 'SHA256: ' + self.deb_sha256, |
679 | 174 | u'Phased-Update-Percentage: 50', | 176 | 'Phased-Update-Percentage: 50', |
680 | 175 | u'Description: Foo app is great', | 177 | 'Description: Foo app is great', |
681 | 176 | u' Well ...', | 178 | ' Well ...', |
682 | 177 | u' it does nothing, though'], | 179 | ' it does nothing, though'], |
683 | 178 | build_bpph_stanza(pub_binary).makeOutput().splitlines()) | 180 | build_bpph_stanza(pub_binary).makeOutput().splitlines()) |
684 | 179 | 181 | ||
685 | 180 | def testBinaryStanzaWithCustomFields(self): | 182 | def testBinaryStanzaWithCustomFields(self): |
686 | @@ -189,32 +191,32 @@ | |||
687 | 189 | user_defined_fields=[("Python-Version", ">= 2.4")]) | 191 | user_defined_fields=[("Python-Version", ">= 2.4")]) |
688 | 190 | pub_binary = pub_binaries[0] | 192 | pub_binary = pub_binaries[0] |
689 | 191 | self.assertEqual( | 193 | self.assertEqual( |
716 | 192 | [u'Package: foo-bin', | 194 | ['Package: foo-bin', |
717 | 193 | u'Source: foo', | 195 | 'Source: foo', |
718 | 194 | u'Priority: standard', | 196 | 'Priority: standard', |
719 | 195 | u'Section: base', | 197 | 'Section: base', |
720 | 196 | u'Installed-Size: 100', | 198 | 'Installed-Size: 100', |
721 | 197 | u'Maintainer: Foo Bar <foo@bar.com>', | 199 | 'Maintainer: Foo Bar <foo@bar.com>', |
722 | 198 | u'Architecture: all', | 200 | 'Architecture: all', |
723 | 199 | u'Version: 666', | 201 | 'Version: 666', |
724 | 200 | u'Recommends: foo-dev', | 202 | 'Recommends: foo-dev', |
725 | 201 | u'Replaces: old-foo', | 203 | 'Replaces: old-foo', |
726 | 202 | u'Suggests: pyfoo', | 204 | 'Suggests: pyfoo', |
727 | 203 | u'Provides: foo-master', | 205 | 'Provides: foo-master', |
728 | 204 | u'Depends: biscuit', | 206 | 'Depends: biscuit', |
729 | 205 | u'Conflicts: old-foo', | 207 | 'Conflicts: old-foo', |
730 | 206 | u'Pre-Depends: master-foo', | 208 | 'Pre-Depends: master-foo', |
731 | 207 | u'Enhances: foo-super', | 209 | 'Enhances: foo-super', |
732 | 208 | u'Breaks: old-foo', | 210 | 'Breaks: old-foo', |
733 | 209 | u'Filename: pool/main/f/foo/foo-bin_666_all.deb', | 211 | 'Filename: pool/main/f/foo/foo-bin_666_all.deb', |
734 | 210 | u'Size: 18', | 212 | 'Size: 18', |
735 | 211 | u'MD5sum: ' + self.deb_md5, | 213 | 'MD5sum: ' + self.deb_md5, |
736 | 212 | u'SHA1: ' + self.deb_sha1, | 214 | 'SHA1: ' + self.deb_sha1, |
737 | 213 | u'SHA256: ' + self.deb_sha256, | 215 | 'SHA256: ' + self.deb_sha256, |
738 | 214 | u'Description: Foo app is great', | 216 | 'Description: Foo app is great', |
739 | 215 | u' Well ...', | 217 | ' Well ...', |
740 | 216 | u' it does nothing, though', | 218 | ' it does nothing, though', |
741 | 217 | u'Python-Version: >= 2.4'], | 219 | 'Python-Version: >= 2.4'], |
742 | 218 | build_bpph_stanza(pub_binary).makeOutput().splitlines()) | 220 | build_bpph_stanza(pub_binary).makeOutput().splitlines()) |
743 | 219 | 221 | ||
744 | 220 | def testBinaryStanzaDescription(self): | 222 | def testBinaryStanzaDescription(self): |
745 | @@ -245,26 +247,26 @@ | |||
746 | 245 | description=description)[0] | 247 | description=description)[0] |
747 | 246 | 248 | ||
748 | 247 | self.assertEqual( | 249 | self.assertEqual( |
769 | 248 | [u'Package: foo-bin', | 250 | ['Package: foo-bin', |
770 | 249 | u'Source: foo', | 251 | 'Source: foo', |
771 | 250 | u'Priority: standard', | 252 | 'Priority: standard', |
772 | 251 | u'Section: base', | 253 | 'Section: base', |
773 | 252 | u'Installed-Size: 100', | 254 | 'Installed-Size: 100', |
774 | 253 | u'Maintainer: Foo Bar <foo@bar.com>', | 255 | 'Maintainer: Foo Bar <foo@bar.com>', |
775 | 254 | u'Architecture: all', | 256 | 'Architecture: all', |
776 | 255 | u'Version: 666', | 257 | 'Version: 666', |
777 | 256 | u'Filename: pool/main/f/foo/foo-bin_666_all.deb', | 258 | 'Filename: pool/main/f/foo/foo-bin_666_all.deb', |
778 | 257 | u'Size: 18', | 259 | 'Size: 18', |
779 | 258 | u'MD5sum: ' + self.deb_md5, | 260 | 'MD5sum: ' + self.deb_md5, |
780 | 259 | u'SHA1: ' + self.deb_sha1, | 261 | 'SHA1: ' + self.deb_sha1, |
781 | 260 | u'SHA256: ' + self.deb_sha256, | 262 | 'SHA256: ' + self.deb_sha256, |
782 | 261 | u'Description: Foo app is great', | 263 | 'Description: Foo app is great', |
783 | 262 | u' Normal', | 264 | ' Normal', |
784 | 263 | u' Normal', | 265 | ' Normal', |
785 | 264 | u' .', | 266 | ' .', |
786 | 265 | u' .', | 267 | ' .', |
787 | 266 | u' .', | 268 | ' .', |
788 | 267 | u' %s' % ('x' * 100), | 269 | ' %s' % ('x' * 100), |
789 | 268 | ], | 270 | ], |
790 | 269 | build_bpph_stanza(pub_binary).makeOutput().splitlines()) | 271 | build_bpph_stanza(pub_binary).makeOutput().splitlines()) |
791 | 270 | 272 | ||
792 | @@ -277,26 +279,26 @@ | |||
793 | 277 | The encoding should be preserved and able to be encoded in | 279 | The encoding should be preserved and able to be encoded in |
794 | 278 | 'utf-8' for disk writing. | 280 | 'utf-8' for disk writing. |
795 | 279 | """ | 281 | """ |
797 | 280 | description = u'Using non-ascii as: \xe7\xe3\xe9\xf3' | 282 | description = 'Using non-ascii as: \xe7\xe3\xe9\xf3' |
798 | 281 | pub_binary = self.getPubBinaries( | 283 | pub_binary = self.getPubBinaries( |
799 | 282 | description=description)[0] | 284 | description=description)[0] |
800 | 283 | 285 | ||
801 | 284 | self.assertEqual( | 286 | self.assertEqual( |
817 | 285 | [u'Package: foo-bin', | 287 | ['Package: foo-bin', |
818 | 286 | u'Source: foo', | 288 | 'Source: foo', |
819 | 287 | u'Priority: standard', | 289 | 'Priority: standard', |
820 | 288 | u'Section: base', | 290 | 'Section: base', |
821 | 289 | u'Installed-Size: 100', | 291 | 'Installed-Size: 100', |
822 | 290 | u'Maintainer: Foo Bar <foo@bar.com>', | 292 | 'Maintainer: Foo Bar <foo@bar.com>', |
823 | 291 | u'Architecture: all', | 293 | 'Architecture: all', |
824 | 292 | u'Version: 666', | 294 | 'Version: 666', |
825 | 293 | u'Filename: pool/main/f/foo/foo-bin_666_all.deb', | 295 | 'Filename: pool/main/f/foo/foo-bin_666_all.deb', |
826 | 294 | u'Size: 18', | 296 | 'Size: 18', |
827 | 295 | u'MD5sum: ' + self.deb_md5, | 297 | 'MD5sum: ' + self.deb_md5, |
828 | 296 | u'SHA1: ' + self.deb_sha1, | 298 | 'SHA1: ' + self.deb_sha1, |
829 | 297 | u'SHA256: ' + self.deb_sha256, | 299 | 'SHA256: ' + self.deb_sha256, |
830 | 298 | u'Description: Foo app is great', | 300 | 'Description: Foo app is great', |
831 | 299 | u' Using non-ascii as: \xe7\xe3\xe9\xf3', | 301 | ' Using non-ascii as: \xe7\xe3\xe9\xf3', |
832 | 300 | ], | 302 | ], |
833 | 301 | build_bpph_stanza(pub_binary).makeOutput().splitlines()) | 303 | build_bpph_stanza(pub_binary).makeOutput().splitlines()) |
834 | 302 | 304 | ||
835 | @@ -315,7 +317,7 @@ | |||
836 | 315 | pub_binary = self.getPubBinaries( | 317 | pub_binary = self.getPubBinaries( |
837 | 316 | binaryname='foo-bin', pub_source=pub_source)[0] | 318 | binaryname='foo-bin', pub_source=pub_source)[0] |
838 | 317 | self.assertEqual( | 319 | self.assertEqual( |
840 | 318 | u'foo', | 320 | 'foo', |
841 | 319 | get_field(build_bpph_stanza(pub_binary), 'Source')) | 321 | get_field(build_bpph_stanza(pub_binary), 'Source')) |
842 | 320 | 322 | ||
843 | 321 | def testBinaryIncludesDifferingSourceVersion(self): | 323 | def testBinaryIncludesDifferingSourceVersion(self): |
844 | @@ -324,7 +326,7 @@ | |||
845 | 324 | pub_binary = self.getPubBinaries( | 326 | pub_binary = self.getPubBinaries( |
846 | 325 | binaryname='foo', version='999', pub_source=pub_source)[0] | 327 | binaryname='foo', version='999', pub_source=pub_source)[0] |
847 | 326 | self.assertEqual( | 328 | self.assertEqual( |
849 | 327 | u'foo (666)', | 329 | 'foo (666)', |
850 | 328 | get_field(build_bpph_stanza(pub_binary), 'Source')) | 330 | get_field(build_bpph_stanza(pub_binary), 'Source')) |
851 | 329 | 331 | ||
852 | 330 | 332 | ||
853 | 331 | 333 | ||
854 | === modified file 'lib/lp/archivepublisher/tests/test_pool.py' | |||
855 | --- lib/lp/archivepublisher/tests/test_pool.py 2010-12-20 07:52:32 +0000 | |||
856 | +++ lib/lp/archivepublisher/tests/test_pool.py 2018-02-02 11:57:41 +0000 | |||
857 | @@ -1,8 +1,10 @@ | |||
859 | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
860 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
861 | 3 | 3 | ||
862 | 4 | """Tests for pool.py.""" | 4 | """Tests for pool.py.""" |
863 | 5 | 5 | ||
864 | 6 | from __future__ import absolute_import, print_function, unicode_literals | ||
865 | 7 | |||
866 | 6 | __metaclass__ = type | 8 | __metaclass__ = type |
867 | 7 | 9 | ||
868 | 8 | import hashlib | 10 | import hashlib |
869 | 9 | 11 | ||
870 | === modified file 'lib/lp/archivepublisher/tests/test_processaccepted.py' | |||
871 | --- lib/lp/archivepublisher/tests/test_processaccepted.py 2014-08-09 19:45:00 +0000 | |||
872 | +++ lib/lp/archivepublisher/tests/test_processaccepted.py 2018-02-02 11:57:41 +0000 | |||
873 | @@ -1,8 +1,10 @@ | |||
875 | 1 | # Copyright 2010-2014 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2010-2018 Canonical Ltd. This software is licensed under the |
876 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
877 | 3 | 3 | ||
878 | 4 | """Test process-accepted.py""" | 4 | """Test process-accepted.py""" |
879 | 5 | 5 | ||
880 | 6 | from __future__ import absolute_import, print_function, unicode_literals | ||
881 | 7 | |||
882 | 6 | from optparse import OptionValueError | 8 | from optparse import OptionValueError |
883 | 7 | 9 | ||
884 | 8 | from testtools.matchers import LessThan | 10 | from testtools.matchers import LessThan |
885 | @@ -35,7 +37,7 @@ | |||
886 | 35 | TestCaseWithFactory.setUp(self) | 37 | TestCaseWithFactory.setUp(self) |
887 | 36 | self.stp = SoyuzTestPublisher() | 38 | self.stp = SoyuzTestPublisher() |
888 | 37 | self.stp.prepareBreezyAutotest() | 39 | self.stp.prepareBreezyAutotest() |
890 | 38 | self.test_package_name = u"accept-test" | 40 | self.test_package_name = "accept-test" |
891 | 39 | self.distro = self.factory.makeDistribution() | 41 | self.distro = self.factory.makeDistribution() |
892 | 40 | 42 | ||
893 | 41 | def getScript(self, test_args=None): | 43 | def getScript(self, test_args=None): |
894 | 42 | 44 | ||
895 | === modified file 'lib/lp/archivepublisher/tests/test_processdeathrow.py' | |||
896 | --- lib/lp/archivepublisher/tests/test_processdeathrow.py 2014-08-09 19:45:00 +0000 | |||
897 | +++ lib/lp/archivepublisher/tests/test_processdeathrow.py 2018-02-02 11:57:41 +0000 | |||
898 | @@ -1,4 +1,4 @@ | |||
900 | 1 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
901 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
902 | 3 | 3 | ||
903 | 4 | """Functional tests for process-death-row.py script. | 4 | """Functional tests for process-death-row.py script. |
904 | @@ -8,6 +8,8 @@ | |||
905 | 8 | processes its arguments and handles dry-run correctly. | 8 | processes its arguments and handles dry-run correctly. |
906 | 9 | """ | 9 | """ |
907 | 10 | 10 | ||
908 | 11 | from __future__ import absolute_import, print_function, unicode_literals | ||
909 | 12 | |||
910 | 11 | __metaclass__ = type | 13 | __metaclass__ = type |
911 | 12 | 14 | ||
912 | 13 | import datetime | 15 | import datetime |
913 | @@ -105,12 +107,12 @@ | |||
914 | 105 | 107 | ||
915 | 106 | cprov = getUtility(IPersonSet).getByName('cprov') | 108 | cprov = getUtility(IPersonSet).getByName('cprov') |
916 | 107 | removeSecurityProxy(cprov.archive).distribution = ubuntutest | 109 | removeSecurityProxy(cprov.archive).distribution = ubuntutest |
918 | 108 | ppa_pubrecs = cprov.archive.getPublishedSources(u'iceweasel') | 110 | ppa_pubrecs = cprov.archive.getPublishedSources('iceweasel') |
919 | 109 | self.ppa_pubrec_ids = self.markPublishingForRemoval(ppa_pubrecs) | 111 | self.ppa_pubrec_ids = self.markPublishingForRemoval(ppa_pubrecs) |
920 | 110 | 112 | ||
921 | 111 | mark = getUtility(IPersonSet).getByName('mark') | 113 | mark = getUtility(IPersonSet).getByName('mark') |
922 | 112 | removeSecurityProxy(mark.archive).distribution = ubuntutest | 114 | removeSecurityProxy(mark.archive).distribution = ubuntutest |
924 | 113 | ppa_pubrecs = mark.archive.getPublishedSources(u'iceweasel') | 115 | ppa_pubrecs = mark.archive.getPublishedSources('iceweasel') |
925 | 114 | self.ppa_pubrec_ids.extend(self.markPublishingForRemoval(ppa_pubrecs)) | 116 | self.ppa_pubrec_ids.extend(self.markPublishingForRemoval(ppa_pubrecs)) |
926 | 115 | 117 | ||
927 | 116 | # Fill one of the files in cprov PPA just to ensure that deathrow | 118 | # Fill one of the files in cprov PPA just to ensure that deathrow |
928 | 117 | 119 | ||
929 | === modified file 'lib/lp/archivepublisher/tests/test_publish_ftpmaster.py' | |||
930 | --- lib/lp/archivepublisher/tests/test_publish_ftpmaster.py 2016-12-05 22:16:25 +0000 | |||
931 | +++ lib/lp/archivepublisher/tests/test_publish_ftpmaster.py 2018-02-02 11:57:41 +0000 | |||
932 | @@ -1,8 +1,10 @@ | |||
934 | 1 | # Copyright 2011-2016 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2011-2018 Canonical Ltd. This software is licensed under the |
935 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
936 | 3 | 3 | ||
937 | 4 | """Test publish-ftpmaster cron script.""" | 4 | """Test publish-ftpmaster cron script.""" |
938 | 5 | 5 | ||
939 | 6 | from __future__ import absolute_import, print_function, unicode_literals | ||
940 | 7 | |||
941 | 6 | __metaclass__ = type | 8 | __metaclass__ = type |
942 | 7 | 9 | ||
943 | 8 | import logging | 10 | import logging |
944 | @@ -1306,7 +1308,7 @@ | |||
945 | 1306 | have_fresh_series = script.prepareFreshSeries(distro) | 1308 | have_fresh_series = script.prepareFreshSeries(distro) |
946 | 1307 | self.assertTrue(have_fresh_series) | 1309 | self.assertTrue(have_fresh_series) |
947 | 1308 | [copied_upload] = new_series.getPackageUploads( | 1310 | [copied_upload] = new_series.getPackageUploads( |
949 | 1309 | name=u'debian-installer-images', exact_match=False) | 1311 | name='debian-installer-images', exact_match=False) |
950 | 1310 | [copied_custom] = copied_upload.customfiles | 1312 | [copied_custom] = copied_upload.customfiles |
951 | 1311 | self.assertEqual( | 1313 | self.assertEqual( |
952 | 1312 | custom_upload.customfiles[0].libraryfilealias.filename, | 1314 | custom_upload.customfiles[0].libraryfilealias.filename, |
953 | 1313 | 1315 | ||
954 | === modified file 'lib/lp/archivepublisher/tests/test_publishdistro.py' | |||
955 | --- lib/lp/archivepublisher/tests/test_publishdistro.py 2017-04-29 15:24:32 +0000 | |||
956 | +++ lib/lp/archivepublisher/tests/test_publishdistro.py 2018-02-02 11:57:41 +0000 | |||
957 | @@ -1,8 +1,10 @@ | |||
959 | 1 | # Copyright 2009-2017 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
960 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
961 | 3 | 3 | ||
962 | 4 | """Functional tests for publish-distro.py script.""" | 4 | """Functional tests for publish-distro.py script.""" |
963 | 5 | 5 | ||
964 | 6 | from __future__ import absolute_import, print_function, unicode_literals | ||
965 | 7 | |||
966 | 6 | __metaclass__ = type | 8 | __metaclass__ = type |
967 | 7 | 9 | ||
968 | 8 | from optparse import OptionValueError | 10 | from optparse import OptionValueError |
969 | 9 | 11 | ||
970 | === modified file 'lib/lp/archivepublisher/tests/test_publisher.py' | |||
971 | --- lib/lp/archivepublisher/tests/test_publisher.py 2017-04-29 15:24:32 +0000 | |||
972 | +++ lib/lp/archivepublisher/tests/test_publisher.py 2018-02-02 11:57:41 +0000 | |||
973 | @@ -1,8 +1,10 @@ | |||
975 | 1 | # Copyright 2009-2017 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
976 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
977 | 3 | 3 | ||
978 | 4 | """Tests for publisher class.""" | 4 | """Tests for publisher class.""" |
979 | 5 | 5 | ||
980 | 6 | from __future__ import absolute_import, print_function, unicode_literals | ||
981 | 7 | |||
982 | 6 | __metaclass__ = type | 8 | __metaclass__ = type |
983 | 7 | 9 | ||
984 | 8 | import bz2 | 10 | import bz2 |
985 | @@ -450,7 +452,7 @@ | |||
986 | 450 | for pu_build in pu_i386.builds: | 452 | for pu_build in pu_i386.builds: |
987 | 451 | pu_build.publish() | 453 | pu_build.publish() |
988 | 452 | 454 | ||
990 | 453 | publications = archive.getAllPublishedBinaries(name=u"bin-i386") | 455 | publications = archive.getAllPublishedBinaries(name="bin-i386") |
991 | 454 | 456 | ||
992 | 455 | self.assertEqual(1, publications.count()) | 457 | self.assertEqual(1, publications.count()) |
993 | 456 | self.assertEqual( | 458 | self.assertEqual( |
994 | @@ -809,14 +811,14 @@ | |||
995 | 809 | self.assertFalse(os.path.exists(publisher._config.metaroot)) | 811 | self.assertFalse(os.path.exists(publisher._config.metaroot)) |
996 | 810 | self.assertEqual(ArchiveStatus.DELETED, test_archive.status) | 812 | self.assertEqual(ArchiveStatus.DELETED, test_archive.status) |
997 | 811 | self.assertEqual(False, test_archive.publish) | 813 | self.assertEqual(False, test_archive.publish) |
999 | 812 | self.assertEqual(u'testing-deletedppa', test_archive.name) | 814 | self.assertEqual('testing-deletedppa', test_archive.name) |
1000 | 813 | 815 | ||
1001 | 814 | # All of the archive's active publications have been marked | 816 | # All of the archive's active publications have been marked |
1002 | 815 | # DELETED, and dateremoved has been set early because they've | 817 | # DELETED, and dateremoved has been set early because they've |
1003 | 816 | # already been removed from disk. | 818 | # already been removed from disk. |
1004 | 817 | for pub in (spph, bpph, orphaned_bpph): | 819 | for pub in (spph, bpph, orphaned_bpph): |
1005 | 818 | self.assertEqual(PackagePublishingStatus.DELETED, pub.status) | 820 | self.assertEqual(PackagePublishingStatus.DELETED, pub.status) |
1007 | 819 | self.assertEqual(u'janitor', pub.removed_by.name) | 821 | self.assertEqual('janitor', pub.removed_by.name) |
1008 | 820 | self.assertIsNot(None, pub.dateremoved) | 822 | self.assertIsNot(None, pub.dateremoved) |
1009 | 821 | 823 | ||
1010 | 822 | # The SUPERSEDED publications now have dateremoved set, even | 824 | # The SUPERSEDED publications now have dateremoved set, even |
1011 | @@ -1252,7 +1254,7 @@ | |||
1012 | 1252 | self.assertEqual( | 1254 | self.assertEqual( |
1013 | 1253 | cprov.archive, archive_publisher.archive) | 1255 | cprov.archive, archive_publisher.archive) |
1014 | 1254 | self.assertEqual( | 1256 | self.assertEqual( |
1016 | 1255 | u'/var/tmp/ppa.test/cprov/ppa/ubuntutest/dists', | 1257 | '/var/tmp/ppa.test/cprov/ppa/ubuntutest/dists', |
1017 | 1256 | archive_publisher._config.distsroot) | 1258 | archive_publisher._config.distsroot) |
1018 | 1257 | self.assertEqual( | 1259 | self.assertEqual( |
1019 | 1258 | [('breezy-autotest', PackagePublishingPocket.RELEASE)], | 1260 | [('breezy-autotest', PackagePublishingPocket.RELEASE)], |
1020 | @@ -1933,7 +1935,7 @@ | |||
1021 | 1933 | """ | 1935 | """ |
1022 | 1934 | allowed_suites = [] | 1936 | allowed_suites = [] |
1023 | 1935 | cprov = getUtility(IPersonSet).getByName('cprov') | 1937 | cprov = getUtility(IPersonSet).getByName('cprov') |
1025 | 1936 | cprov.archive.displayname = u'PPA for Celso Provid\xe8lo' | 1938 | cprov.archive.displayname = 'PPA for Celso Provid\xe8lo' |
1026 | 1937 | archive_publisher = getPublisher( | 1939 | archive_publisher = getPublisher( |
1027 | 1938 | cprov.archive, allowed_suites, self.logger) | 1940 | cprov.archive, allowed_suites, self.logger) |
1028 | 1939 | 1941 | ||
1029 | @@ -1950,7 +1952,7 @@ | |||
1030 | 1950 | self.assertEqual('LP-PPA-cprov', release['origin']) | 1952 | self.assertEqual('LP-PPA-cprov', release['origin']) |
1031 | 1951 | 1953 | ||
1032 | 1952 | # The Label: field should be set to the archive displayname | 1954 | # The Label: field should be set to the archive displayname |
1034 | 1953 | self.assertEqual(u'PPA for Celso Provid\xe8lo', release['label']) | 1955 | self.assertEqual('PPA for Celso Provid\xe8lo', release['label']) |
1035 | 1954 | 1956 | ||
1036 | 1955 | arch_sources_path = os.path.join( | 1957 | arch_sources_path = os.path.join( |
1037 | 1956 | archive_publisher._config.distsroot, 'breezy-autotest', | 1958 | archive_publisher._config.distsroot, 'breezy-autotest', |
1038 | @@ -2720,7 +2722,7 @@ | |||
1039 | 2720 | # A no-op run leaves the scheduled deletion date intact. | 2722 | # A no-op run leaves the scheduled deletion date intact. |
1040 | 2721 | i386_file = getUtility(IArchiveFileSet).getByArchive( | 2723 | i386_file = getUtility(IArchiveFileSet).getByArchive( |
1041 | 2722 | self.ubuntutest.main_archive, | 2724 | self.ubuntutest.main_archive, |
1043 | 2723 | path=u'dists/breezy-autotest/Contents-i386').one() | 2725 | path='dists/breezy-autotest/Contents-i386').one() |
1044 | 2724 | i386_date = i386_file.scheduled_deletion_date | 2726 | i386_date = i386_file.scheduled_deletion_date |
1045 | 2725 | self.runSteps(publisher, step_d=True) | 2727 | self.runSteps(publisher, step_d=True) |
1046 | 2726 | flush_database_caches() | 2728 | flush_database_caches() |
1047 | @@ -2746,7 +2748,7 @@ | |||
1048 | 2746 | # Arrange for the second file to be pruned. | 2748 | # Arrange for the second file to be pruned. |
1049 | 2747 | hppa_file = getUtility(IArchiveFileSet).getByArchive( | 2749 | hppa_file = getUtility(IArchiveFileSet).getByArchive( |
1050 | 2748 | self.ubuntutest.main_archive, | 2750 | self.ubuntutest.main_archive, |
1052 | 2749 | path=u'dists/breezy-autotest/Contents-hppa').one() | 2751 | path='dists/breezy-autotest/Contents-hppa').one() |
1053 | 2750 | removeSecurityProxy(hppa_file).scheduled_deletion_date = ( | 2752 | removeSecurityProxy(hppa_file).scheduled_deletion_date = ( |
1054 | 2751 | now - timedelta(hours=1)) | 2753 | now - timedelta(hours=1)) |
1055 | 2752 | self.runSteps(publisher, step_d=True) | 2754 | self.runSteps(publisher, step_d=True) |
1056 | @@ -2809,7 +2811,7 @@ | |||
1057 | 2809 | ByHashHasContents(main_contents)) | 2811 | ByHashHasContents(main_contents)) |
1058 | 2810 | archive_files = getUtility(IArchiveFileSet).getByArchive( | 2812 | archive_files = getUtility(IArchiveFileSet).getByArchive( |
1059 | 2811 | self.ubuntutest.main_archive, | 2813 | self.ubuntutest.main_archive, |
1061 | 2812 | path=u'dists/breezy-autotest/main/source/Sources') | 2814 | path='dists/breezy-autotest/main/source/Sources') |
1062 | 2813 | self.assertThat( | 2815 | self.assertThat( |
1063 | 2814 | sorted(archive_files, key=attrgetter('id')), | 2816 | sorted(archive_files, key=attrgetter('id')), |
1064 | 2815 | MatchesListwise([ | 2817 | MatchesListwise([ |
1065 | 2816 | 2818 | ||
1066 | === modified file 'lib/lp/archivepublisher/tests/test_publisher_documentation.py' | |||
1067 | --- lib/lp/archivepublisher/tests/test_publisher_documentation.py 2012-01-20 15:42:44 +0000 | |||
1068 | +++ lib/lp/archivepublisher/tests/test_publisher_documentation.py 2018-02-02 11:57:41 +0000 | |||
1069 | @@ -1,8 +1,10 @@ | |||
1071 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
1072 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1073 | 3 | 3 | ||
1074 | 4 | """Runs the archivepublisher doctests.""" | 4 | """Runs the archivepublisher doctests.""" |
1075 | 5 | 5 | ||
1076 | 6 | from __future__ import absolute_import, print_function, unicode_literals | ||
1077 | 7 | |||
1078 | 6 | __metaclass__ = type | 8 | __metaclass__ = type |
1079 | 7 | 9 | ||
1080 | 8 | import logging | 10 | import logging |
1081 | 9 | 11 | ||
1082 | === modified file 'lib/lp/archivepublisher/tests/test_publisherconfig.py' | |||
1083 | --- lib/lp/archivepublisher/tests/test_publisherconfig.py 2013-06-20 05:50:00 +0000 | |||
1084 | +++ lib/lp/archivepublisher/tests/test_publisherconfig.py 2018-02-02 11:57:41 +0000 | |||
1085 | @@ -1,8 +1,10 @@ | |||
1087 | 1 | # Copyright 2011 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2011-2018 Canonical Ltd. This software is licensed under the |
1088 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1089 | 3 | 3 | ||
1090 | 4 | """Tests for publisherConfig model class.""" | 4 | """Tests for publisherConfig model class.""" |
1091 | 5 | 5 | ||
1092 | 6 | from __future__ import absolute_import, print_function, unicode_literals | ||
1093 | 7 | |||
1094 | 6 | __metaclass__ = type | 8 | __metaclass__ = type |
1095 | 7 | 9 | ||
1096 | 8 | 10 | ||
1097 | @@ -45,9 +47,9 @@ | |||
1098 | 45 | 47 | ||
1099 | 46 | def test_properties(self): | 48 | def test_properties(self): |
1100 | 47 | # Test the model properties. | 49 | # Test the model properties. |
1104 | 48 | ROOT_DIR = u"rootdir/test" | 50 | ROOT_DIR = "rootdir/test" |
1105 | 49 | BASE_URL = u"http://base.url" | 51 | BASE_URL = "http://base.url" |
1106 | 50 | COPY_BASE_URL = u"http://base.url" | 52 | COPY_BASE_URL = "http://base.url" |
1107 | 51 | pubconf = self.factory.makePublisherConfig( | 53 | pubconf = self.factory.makePublisherConfig( |
1108 | 52 | distribution=self.distribution, | 54 | distribution=self.distribution, |
1109 | 53 | root_dir=ROOT_DIR, | 55 | root_dir=ROOT_DIR, |
1110 | @@ -83,7 +85,7 @@ | |||
1111 | 83 | 85 | ||
1112 | 84 | def test_only_admin(self): | 86 | def test_only_admin(self): |
1113 | 85 | # Only admins can see and change the config. | 87 | # Only admins can see and change the config. |
1115 | 86 | distro = self.factory.makeDistribution(publish_root_dir=u"foo") | 88 | distro = self.factory.makeDistribution(publish_root_dir="foo") |
1116 | 87 | config = getUtility(IPublisherConfigSet).getByDistribution(distro) | 89 | config = getUtility(IPublisherConfigSet).getByDistribution(distro) |
1117 | 88 | 90 | ||
1118 | 89 | login(ANONYMOUS) | 91 | login(ANONYMOUS) |
1119 | @@ -91,6 +93,6 @@ | |||
1120 | 91 | self.assertRaises(Unauthorized, setattr, config, "root_dir", "test") | 93 | self.assertRaises(Unauthorized, setattr, config, "root_dir", "test") |
1121 | 92 | 94 | ||
1122 | 93 | login(LAUNCHPAD_ADMIN) | 95 | login(LAUNCHPAD_ADMIN) |
1126 | 94 | self.assertEqual(u"foo", config.root_dir) | 96 | self.assertEqual("foo", config.root_dir) |
1127 | 95 | config.root_dir = u"bar" | 97 | config.root_dir = "bar" |
1128 | 96 | self.assertEqual(u"bar", config.root_dir) | 98 | self.assertEqual("bar", config.root_dir) |
1129 | 97 | 99 | ||
1130 | === modified file 'lib/lp/archivepublisher/tests/test_repositoryindexfile.py' | |||
1131 | --- lib/lp/archivepublisher/tests/test_repositoryindexfile.py 2016-10-04 01:27:20 +0000 | |||
1132 | +++ lib/lp/archivepublisher/tests/test_repositoryindexfile.py 2018-02-02 11:57:41 +0000 | |||
1133 | @@ -1,8 +1,10 @@ | |||
1135 | 1 | # Copyright 2009-2016 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2018 Canonical Ltd. This software is licensed under the |
1136 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1137 | 3 | 3 | ||
1138 | 4 | """Tests for `RepositoryIndexFile`.""" | 4 | """Tests for `RepositoryIndexFile`.""" |
1139 | 5 | 5 | ||
1140 | 6 | from __future__ import absolute_import, print_function, unicode_literals | ||
1141 | 7 | |||
1142 | 6 | __metaclass__ = type | 8 | __metaclass__ = type |
1143 | 7 | 9 | ||
1144 | 8 | import bz2 | 10 | import bz2 |
1145 | 9 | 11 | ||
1146 | === modified file 'lib/lp/archivepublisher/tests/test_rosetta_translations.py' | |||
1147 | --- lib/lp/archivepublisher/tests/test_rosetta_translations.py 2016-05-23 10:14:39 +0000 | |||
1148 | +++ lib/lp/archivepublisher/tests/test_rosetta_translations.py 2018-02-02 11:57:41 +0000 | |||
1149 | @@ -1,4 +1,4 @@ | |||
1151 | 1 | # Copyright 2013-2016 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2013-2018 Canonical Ltd. This software is licensed under the |
1152 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1153 | 3 | 3 | ||
1154 | 4 | """Test rosetta-translations custom uploads. | 4 | """Test rosetta-translations custom uploads. |
1155 | @@ -7,6 +7,8 @@ | |||
1156 | 7 | high-level tests of rosetta-translations upload and queue manipulation. | 7 | high-level tests of rosetta-translations upload and queue manipulation. |
1157 | 8 | """ | 8 | """ |
1158 | 9 | 9 | ||
1159 | 10 | from __future__ import absolute_import, print_function, unicode_literals | ||
1160 | 11 | |||
1161 | 10 | from storm.expr import Desc | 12 | from storm.expr import Desc |
1162 | 11 | import transaction | 13 | import transaction |
1163 | 12 | from zope.component import getUtility | 14 | from zope.component import getUtility |
1164 | @@ -50,8 +52,8 @@ | |||
1165 | 50 | """Create an LibraryFileAlias containing dummy translation data.""" | 52 | """Create an LibraryFileAlias containing dummy translation data.""" |
1166 | 51 | if tar_content is None: | 53 | if tar_content is None: |
1167 | 52 | tar_content = { | 54 | tar_content = { |
1170 | 53 | 'source/po/foo.pot': 'Foo template', | 55 | 'source/po/foo.pot': b'Foo template', |
1171 | 54 | 'source/po/eo.po': 'Foo translation', | 56 | 'source/po/eo.po': b'Foo translation', |
1172 | 55 | } | 57 | } |
1173 | 56 | tarfile_content = LaunchpadWriteTarFile.files_to_string( | 58 | tarfile_content = LaunchpadWriteTarFile.files_to_string( |
1174 | 57 | tar_content) | 59 | tar_content) |
1175 | 58 | 60 | ||
1176 | === modified file 'lib/lp/archivepublisher/tests/test_signing.py' | |||
1177 | --- lib/lp/archivepublisher/tests/test_signing.py 2017-08-02 19:13:48 +0000 | |||
1178 | +++ lib/lp/archivepublisher/tests/test_signing.py 2018-02-02 11:57:41 +0000 | |||
1179 | @@ -1,8 +1,10 @@ | |||
1181 | 1 | # Copyright 2012-2017 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2012-2018 Canonical Ltd. This software is licensed under the |
1182 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
1183 | 3 | 3 | ||
1184 | 4 | """Test UEFI custom uploads.""" | 4 | """Test UEFI custom uploads.""" |
1185 | 5 | 5 | ||
1186 | 6 | from __future__ import absolute_import, print_function, unicode_literals | ||
1187 | 7 | |||
1188 | 6 | __metaclass__ = type | 8 | __metaclass__ = type |
1189 | 7 | 9 | ||
1190 | 8 | import os | 10 | import os |
1191 | @@ -255,9 +257,9 @@ | |||
1192 | 255 | if not os.path.exists(pubconf.temproot): | 257 | if not os.path.exists(pubconf.temproot): |
1193 | 256 | os.makedirs(pubconf.temproot) | 258 | os.makedirs(pubconf.temproot) |
1194 | 257 | self.openArchive("test", "1.0", "amd64") | 259 | self.openArchive("test", "1.0", "amd64") |
1198 | 258 | self.tarfile.add_file("1.0/empty.efi", "") | 260 | self.tarfile.add_file("1.0/empty.efi", b"") |
1199 | 259 | self.tarfile.add_file("1.0/empty.ko", "") | 261 | self.tarfile.add_file("1.0/empty.ko", b"") |
1200 | 260 | self.tarfile.add_file("1.0/empty.opal", "") | 262 | self.tarfile.add_file("1.0/empty.opal", b"") |
1201 | 261 | upload = self.process_emulate() | 263 | upload = self.process_emulate() |
1202 | 262 | self.assertContentEqual([], upload.callLog.caller_list()) | 264 | self.assertContentEqual([], upload.callLog.caller_list()) |
1203 | 263 | 265 | ||
1204 | @@ -265,9 +267,9 @@ | |||
1205 | 265 | # If the configured key/cert are missing, processing succeeds but | 267 | # If the configured key/cert are missing, processing succeeds but |
1206 | 266 | # nothing is signed. | 268 | # nothing is signed. |
1207 | 267 | self.openArchive("test", "1.0", "amd64") | 269 | self.openArchive("test", "1.0", "amd64") |
1211 | 268 | self.tarfile.add_file("1.0/empty.efi", "") | 270 | self.tarfile.add_file("1.0/empty.efi", b"") |
1212 | 269 | self.tarfile.add_file("1.0/empty.ko", "") | 271 | self.tarfile.add_file("1.0/empty.ko", b"") |
1213 | 270 | self.tarfile.add_file("1.0/empty.opal", "") | 272 | self.tarfile.add_file("1.0/empty.opal", b"") |
1214 | 271 | upload = self.process_emulate() | 273 | upload = self.process_emulate() |
1215 | 272 | self.assertContentEqual([], upload.callLog.caller_list()) | 274 | self.assertContentEqual([], upload.callLog.caller_list()) |
1216 | 273 | 275 | ||
1217 | @@ -277,9 +279,9 @@ | |||
1218 | 277 | self.setUpUefiKeys() | 279 | self.setUpUefiKeys() |
1219 | 278 | self.setUpKmodKeys() | 280 | self.setUpKmodKeys() |
1220 | 279 | self.openArchive("test", "1.0", "amd64") | 281 | self.openArchive("test", "1.0", "amd64") |
1224 | 280 | self.tarfile.add_file("1.0/empty.efi", "") | 282 | self.tarfile.add_file("1.0/empty.efi", b"") |
1225 | 281 | self.tarfile.add_file("1.0/empty.ko", "") | 283 | self.tarfile.add_file("1.0/empty.ko", b"") |
1226 | 282 | self.tarfile.add_file("1.0/empty.opal", "") | 284 | self.tarfile.add_file("1.0/empty.opal", b"") |
1227 | 283 | upload = self.process_emulate() | 285 | upload = self.process_emulate() |
1228 | 284 | expected_callers = [ | 286 | expected_callers = [ |
1229 | 285 | ('UEFI signing', 1), | 287 | ('UEFI signing', 1), |
1230 | @@ -292,9 +294,9 @@ | |||
1231 | 292 | # nothing is signed. | 294 | # nothing is signed. |
1232 | 293 | self.setUpPPA() | 295 | self.setUpPPA() |
1233 | 294 | self.openArchive("test", "1.0", "amd64") | 296 | self.openArchive("test", "1.0", "amd64") |
1237 | 295 | self.tarfile.add_file("1.0/empty.efi", "") | 297 | self.tarfile.add_file("1.0/empty.efi", b"") |
1238 | 296 | self.tarfile.add_file("1.0/empty.ko", "") | 298 | self.tarfile.add_file("1.0/empty.ko", b"") |
1239 | 297 | self.tarfile.add_file("1.0/empty.opal", "") | 299 | self.tarfile.add_file("1.0/empty.opal", b"") |
1240 | 298 | upload = self.process_emulate() | 300 | upload = self.process_emulate() |
1241 | 299 | expected_callers = [ | 301 | expected_callers = [ |
1242 | 300 | ('UEFI keygen', 1), | 302 | ('UEFI keygen', 1), |
1243 | @@ -352,7 +354,7 @@ | |||
1244 | 352 | # If the configured key/cert are missing, processing succeeds but | 354 | # If the configured key/cert are missing, processing succeeds but |
1245 | 353 | # nothing is signed. | 355 | # nothing is signed. |
1246 | 354 | self.openArchive("test", "1.0", "amd64") | 356 | self.openArchive("test", "1.0", "amd64") |
1248 | 355 | self.tarfile.add_file("1.0/control/options", "") | 357 | self.tarfile.add_file("1.0/control/options", b"") |
1249 | 356 | upload = self.process_emulate() | 358 | upload = self.process_emulate() |
1250 | 357 | self.assertContentEqual([], upload.signing_options.keys()) | 359 | self.assertContentEqual([], upload.signing_options.keys()) |
1251 | 358 | 360 | ||
1252 | @@ -360,7 +362,7 @@ | |||
1253 | 360 | # If the configured key/cert are missing, processing succeeds but | 362 | # If the configured key/cert are missing, processing succeeds but |
1254 | 361 | # nothing is signed. | 363 | # nothing is signed. |
1255 | 362 | self.openArchive("test", "1.0", "amd64") | 364 | self.openArchive("test", "1.0", "amd64") |
1257 | 363 | self.tarfile.add_file("1.0/control/options", "first\n") | 365 | self.tarfile.add_file("1.0/control/options", b"first\n") |
1258 | 364 | upload = self.process_emulate() | 366 | upload = self.process_emulate() |
1259 | 365 | self.assertContentEqual(['first'], upload.signing_options.keys()) | 367 | self.assertContentEqual(['first'], upload.signing_options.keys()) |
1260 | 366 | 368 | ||
1261 | @@ -368,7 +370,7 @@ | |||
1262 | 368 | # If the configured key/cert are missing, processing succeeds but | 370 | # If the configured key/cert are missing, processing succeeds but |
1263 | 369 | # nothing is signed. | 371 | # nothing is signed. |
1264 | 370 | self.openArchive("test", "1.0", "amd64") | 372 | self.openArchive("test", "1.0", "amd64") |
1266 | 371 | self.tarfile.add_file("1.0/control/options", "first\nsecond\n") | 373 | self.tarfile.add_file("1.0/control/options", b"first\nsecond\n") |
1267 | 372 | upload = self.process_emulate() | 374 | upload = self.process_emulate() |
1268 | 373 | self.assertContentEqual(['first', 'second'], | 375 | self.assertContentEqual(['first', 'second'], |
1269 | 374 | upload.signing_options.keys()) | 376 | upload.signing_options.keys()) |
1270 | @@ -379,9 +381,9 @@ | |||
1271 | 379 | self.setUpKmodKeys() | 381 | self.setUpKmodKeys() |
1272 | 380 | self.setUpOpalKeys() | 382 | self.setUpOpalKeys() |
1273 | 381 | self.openArchive("test", "1.0", "amd64") | 383 | self.openArchive("test", "1.0", "amd64") |
1277 | 382 | self.tarfile.add_file("1.0/empty.efi", "") | 384 | self.tarfile.add_file("1.0/empty.efi", b"") |
1278 | 383 | self.tarfile.add_file("1.0/empty.ko", "") | 385 | self.tarfile.add_file("1.0/empty.ko", b"") |
1279 | 384 | self.tarfile.add_file("1.0/empty.opal", "") | 386 | self.tarfile.add_file("1.0/empty.opal", b"") |
1280 | 385 | self.process_emulate() | 387 | self.process_emulate() |
1281 | 386 | self.assertThat(self.getSignedPath("test", "amd64"), SignedMatches([ | 388 | self.assertThat(self.getSignedPath("test", "amd64"), SignedMatches([ |
1282 | 387 | "1.0/SHA256SUMS", | 389 | "1.0/SHA256SUMS", |
1283 | @@ -397,10 +399,10 @@ | |||
1284 | 397 | self.setUpKmodKeys() | 399 | self.setUpKmodKeys() |
1285 | 398 | self.setUpOpalKeys() | 400 | self.setUpOpalKeys() |
1286 | 399 | self.openArchive("test", "1.0", "amd64") | 401 | self.openArchive("test", "1.0", "amd64") |
1291 | 400 | self.tarfile.add_file("1.0/control/options", "tarball") | 402 | self.tarfile.add_file("1.0/control/options", b"tarball") |
1292 | 401 | self.tarfile.add_file("1.0/empty.efi", "") | 403 | self.tarfile.add_file("1.0/empty.efi", b"") |
1293 | 402 | self.tarfile.add_file("1.0/empty.ko", "") | 404 | self.tarfile.add_file("1.0/empty.ko", b"") |
1294 | 403 | self.tarfile.add_file("1.0/empty.opal", "") | 405 | self.tarfile.add_file("1.0/empty.opal", b"") |
1295 | 404 | self.process_emulate() | 406 | self.process_emulate() |
1296 | 405 | self.assertThat(self.getSignedPath("test", "amd64"), SignedMatches([ | 407 | self.assertThat(self.getSignedPath("test", "amd64"), SignedMatches([ |
1297 | 406 | "1.0/SHA256SUMS", | 408 | "1.0/SHA256SUMS", |
1298 | @@ -425,10 +427,10 @@ | |||
1299 | 425 | self.setUpKmodKeys() | 427 | self.setUpKmodKeys() |
1300 | 426 | self.setUpOpalKeys() | 428 | self.setUpOpalKeys() |
1301 | 427 | self.openArchive("test", "1.0", "amd64") | 429 | self.openArchive("test", "1.0", "amd64") |
1306 | 428 | self.tarfile.add_file("1.0/control/options", "signed-only") | 430 | self.tarfile.add_file("1.0/control/options", b"signed-only") |
1307 | 429 | self.tarfile.add_file("1.0/empty.efi", "") | 431 | self.tarfile.add_file("1.0/empty.efi", b"") |
1308 | 430 | self.tarfile.add_file("1.0/empty.ko", "") | 432 | self.tarfile.add_file("1.0/empty.ko", b"") |
1309 | 431 | self.tarfile.add_file("1.0/empty.opal", "") | 433 | self.tarfile.add_file("1.0/empty.opal", b"") |
1310 | 432 | self.process_emulate() | 434 | self.process_emulate() |
1311 | 433 | self.assertThat(self.getSignedPath("test", "amd64"), SignedMatches([ | 435 | self.assertThat(self.getSignedPath("test", "amd64"), SignedMatches([ |
1312 | 434 | "1.0/SHA256SUMS", "1.0/control/options", | 436 | "1.0/SHA256SUMS", "1.0/control/options", |
1313 | @@ -445,11 +447,10 @@ | |||
1314 | 445 | self.setUpKmodKeys() | 447 | self.setUpKmodKeys() |
1315 | 446 | self.setUpOpalKeys() | 448 | self.setUpOpalKeys() |
1316 | 447 | self.openArchive("test", "1.0", "amd64") | 449 | self.openArchive("test", "1.0", "amd64") |
1322 | 448 | self.tarfile.add_file("1.0/control/options", | 450 | self.tarfile.add_file("1.0/control/options", b"tarball\nsigned-only") |
1323 | 449 | "tarball\nsigned-only") | 451 | self.tarfile.add_file("1.0/empty.efi", b"") |
1324 | 450 | self.tarfile.add_file("1.0/empty.efi", "") | 452 | self.tarfile.add_file("1.0/empty.ko", b"") |
1325 | 451 | self.tarfile.add_file("1.0/empty.ko", "") | 453 | self.tarfile.add_file("1.0/empty.opal", b"") |
1321 | 452 | self.tarfile.add_file("1.0/empty.opal", "") | ||
1326 | 453 | self.process_emulate() | 454 | self.process_emulate() |
1327 | 454 | self.assertThat(self.getSignedPath("test", "amd64"), SignedMatches([ | 455 | self.assertThat(self.getSignedPath("test", "amd64"), SignedMatches([ |
1328 | 455 | "1.0/SHA256SUMS", | 456 | "1.0/SHA256SUMS", |
1329 | @@ -470,7 +471,7 @@ | |||
1330 | 470 | # Nothing is signed. | 471 | # Nothing is signed. |
1331 | 471 | self.setUpUefiKeys() | 472 | self.setUpUefiKeys() |
1332 | 472 | self.openArchive("empty", "1.0", "amd64") | 473 | self.openArchive("empty", "1.0", "amd64") |
1334 | 473 | self.tarfile.add_file("1.0/hello", "world") | 474 | self.tarfile.add_file("1.0/hello", b"world") |
1335 | 474 | upload = self.process() | 475 | upload = self.process() |
1336 | 475 | self.assertTrue(os.path.exists(os.path.join( | 476 | self.assertTrue(os.path.exists(os.path.join( |
1337 | 476 | self.getSignedPath("empty", "amd64"), "1.0", "hello"))) | 477 | self.getSignedPath("empty", "amd64"), "1.0", "hello"))) |
1338 | @@ -481,7 +482,7 @@ | |||
1339 | 481 | # If the target directory already exists, processing fails. | 482 | # If the target directory already exists, processing fails. |
1340 | 482 | self.setUpUefiKeys() | 483 | self.setUpUefiKeys() |
1341 | 483 | self.openArchive("test", "1.0", "amd64") | 484 | self.openArchive("test", "1.0", "amd64") |
1343 | 484 | self.tarfile.add_file("1.0/empty.efi", "") | 485 | self.tarfile.add_file("1.0/empty.efi", b"") |
1344 | 485 | os.makedirs(os.path.join(self.getSignedPath("test", "amd64"), "1.0")) | 486 | os.makedirs(os.path.join(self.getSignedPath("test", "amd64"), "1.0")) |
1345 | 486 | self.assertRaises(CustomUploadAlreadyExists, self.process) | 487 | self.assertRaises(CustomUploadAlreadyExists, self.process) |
1346 | 487 | 488 | ||
1347 | @@ -489,7 +490,7 @@ | |||
1348 | 489 | # The umask must be 0o022 to avoid incorrect permissions. | 490 | # The umask must be 0o022 to avoid incorrect permissions. |
1349 | 490 | self.setUpUefiKeys() | 491 | self.setUpUefiKeys() |
1350 | 491 | self.openArchive("test", "1.0", "amd64") | 492 | self.openArchive("test", "1.0", "amd64") |
1352 | 492 | self.tarfile.add_file("1.0/dir/file.efi", "foo") | 493 | self.tarfile.add_file("1.0/dir/file.efi", b"foo") |
1353 | 493 | os.umask(0o002) # cleanup already handled by setUp | 494 | os.umask(0o002) # cleanup already handled by setUp |
1354 | 494 | self.assertRaises(CustomUploadBadUmask, self.process) | 495 | self.assertRaises(CustomUploadBadUmask, self.process) |
1355 | 495 | 496 | ||
1356 | @@ -684,7 +685,7 @@ | |||
1357 | 684 | # Each image in the tarball is signed. | 685 | # Each image in the tarball is signed. |
1358 | 685 | self.setUpUefiKeys() | 686 | self.setUpUefiKeys() |
1359 | 686 | self.openArchive("test", "1.0", "amd64") | 687 | self.openArchive("test", "1.0", "amd64") |
1361 | 687 | self.tarfile.add_file("1.0/empty.efi", "") | 688 | self.tarfile.add_file("1.0/empty.efi", b"") |
1362 | 688 | upload = self.process() | 689 | upload = self.process() |
1363 | 689 | self.assertEqual(1, upload.signUefi.call_count) | 690 | self.assertEqual(1, upload.signUefi.call_count) |
1364 | 690 | 691 | ||
1365 | @@ -692,7 +693,7 @@ | |||
1366 | 692 | # Each image in the tarball is signed. | 693 | # Each image in the tarball is signed. |
1367 | 693 | self.setUpKmodKeys() | 694 | self.setUpKmodKeys() |
1368 | 694 | self.openArchive("test", "1.0", "amd64") | 695 | self.openArchive("test", "1.0", "amd64") |
1370 | 695 | self.tarfile.add_file("1.0/empty.ko", "") | 696 | self.tarfile.add_file("1.0/empty.ko", b"") |
1371 | 696 | upload = self.process() | 697 | upload = self.process() |
1372 | 697 | self.assertEqual(1, upload.signKmod.call_count) | 698 | self.assertEqual(1, upload.signKmod.call_count) |
1373 | 698 | 699 | ||
1374 | @@ -700,7 +701,7 @@ | |||
1375 | 700 | # Each image in the tarball is signed. | 701 | # Each image in the tarball is signed. |
1376 | 701 | self.setUpOpalKeys() | 702 | self.setUpOpalKeys() |
1377 | 702 | self.openArchive("test", "1.0", "amd64") | 703 | self.openArchive("test", "1.0", "amd64") |
1379 | 703 | self.tarfile.add_file("1.0/empty.opal", "") | 704 | self.tarfile.add_file("1.0/empty.opal", b"") |
1380 | 704 | upload = self.process() | 705 | upload = self.process() |
1381 | 705 | self.assertEqual(1, upload.signOpal.call_count) | 706 | self.assertEqual(1, upload.signOpal.call_count) |
1382 | 706 | 707 | ||
1383 | @@ -708,12 +709,12 @@ | |||
1384 | 708 | # Each image in the tarball is signed. | 709 | # Each image in the tarball is signed. |
1385 | 709 | self.setUpKmodKeys() | 710 | self.setUpKmodKeys() |
1386 | 710 | self.openArchive("test", "1.0", "amd64") | 711 | self.openArchive("test", "1.0", "amd64") |
1393 | 711 | self.tarfile.add_file("1.0/empty.efi", "") | 712 | self.tarfile.add_file("1.0/empty.efi", b"") |
1394 | 712 | self.tarfile.add_file("1.0/empty.ko", "") | 713 | self.tarfile.add_file("1.0/empty.ko", b"") |
1395 | 713 | self.tarfile.add_file("1.0/empty2.ko", "") | 714 | self.tarfile.add_file("1.0/empty2.ko", b"") |
1396 | 714 | self.tarfile.add_file("1.0/empty.opal", "") | 715 | self.tarfile.add_file("1.0/empty.opal", b"") |
1397 | 715 | self.tarfile.add_file("1.0/empty2.opal", "") | 716 | self.tarfile.add_file("1.0/empty2.opal", b"") |
1398 | 716 | self.tarfile.add_file("1.0/empty3.opal", "") | 717 | self.tarfile.add_file("1.0/empty3.opal", b"") |
1399 | 717 | upload = self.process() | 718 | upload = self.process() |
1400 | 718 | self.assertEqual(1, upload.signUefi.call_count) | 719 | self.assertEqual(1, upload.signUefi.call_count) |
1401 | 719 | self.assertEqual(2, upload.signKmod.call_count) | 720 | self.assertEqual(2, upload.signKmod.call_count) |
1402 | @@ -723,7 +724,7 @@ | |||
1403 | 723 | # Files in the tarball are installed correctly. | 724 | # Files in the tarball are installed correctly. |
1404 | 724 | self.setUpUefiKeys() | 725 | self.setUpUefiKeys() |
1405 | 725 | self.openArchive("test", "1.0", "amd64") | 726 | self.openArchive("test", "1.0", "amd64") |
1407 | 726 | self.tarfile.add_file("1.0/empty.efi", "") | 727 | self.tarfile.add_file("1.0/empty.efi", b"") |
1408 | 727 | self.process() | 728 | self.process() |
1409 | 728 | self.assertTrue(os.path.isdir(os.path.join( | 729 | self.assertTrue(os.path.isdir(os.path.join( |
1410 | 729 | self.getDistsPath(), "signed"))) | 730 | self.getDistsPath(), "signed"))) |
1411 | @@ -735,7 +736,7 @@ | |||
1412 | 735 | os.makedirs(os.path.join(self.getDistsPath(), "uefi")) | 736 | os.makedirs(os.path.join(self.getDistsPath(), "uefi")) |
1413 | 736 | self.setUpUefiKeys() | 737 | self.setUpUefiKeys() |
1414 | 737 | self.openArchive("test", "1.0", "amd64") | 738 | self.openArchive("test", "1.0", "amd64") |
1416 | 738 | self.tarfile.add_file("1.0/empty.efi", "") | 739 | self.tarfile.add_file("1.0/empty.efi", b"") |
1417 | 739 | self.process() | 740 | self.process() |
1418 | 740 | self.assertTrue(os.path.isdir(os.path.join( | 741 | self.assertTrue(os.path.isdir(os.path.join( |
1419 | 741 | self.getDistsPath(), "signed"))) | 742 | self.getDistsPath(), "signed"))) |
1420 | @@ -747,7 +748,7 @@ | |||
1421 | 747 | os.makedirs(os.path.join(self.getDistsPath(), "signing")) | 748 | os.makedirs(os.path.join(self.getDistsPath(), "signing")) |
1422 | 748 | self.setUpUefiKeys() | 749 | self.setUpUefiKeys() |
1423 | 749 | self.openArchive("test", "1.0", "amd64") | 750 | self.openArchive("test", "1.0", "amd64") |
1425 | 750 | self.tarfile.add_file("1.0/empty.efi", "") | 751 | self.tarfile.add_file("1.0/empty.efi", b"") |
1426 | 751 | self.process() | 752 | self.process() |
1427 | 752 | self.assertTrue(os.path.isdir(os.path.join( | 753 | self.assertTrue(os.path.isdir(os.path.join( |
1428 | 753 | self.getDistsPath(), "signed"))) | 754 | self.getDistsPath(), "signed"))) |
1429 | @@ -870,9 +871,9 @@ | |||
1430 | 870 | self.setUpKmodKeys() | 871 | self.setUpKmodKeys() |
1431 | 871 | self.setUpOpalKeys() | 872 | self.setUpOpalKeys() |
1432 | 872 | self.openArchive("test", "1.0", "amd64") | 873 | self.openArchive("test", "1.0", "amd64") |
1436 | 873 | self.tarfile.add_file("1.0/empty.efi", "") | 874 | self.tarfile.add_file("1.0/empty.efi", b"") |
1437 | 874 | self.tarfile.add_file("1.0/empty.ko", "") | 875 | self.tarfile.add_file("1.0/empty.ko", b"") |
1438 | 875 | self.tarfile.add_file("1.0/empty.opal", "") | 876 | self.tarfile.add_file("1.0/empty.opal", b"") |
1439 | 876 | self.process_emulate() | 877 | self.process_emulate() |
1440 | 877 | sha256file = os.path.join(self.getSignedPath("test", "amd64"), | 878 | sha256file = os.path.join(self.getSignedPath("test", "amd64"), |
1441 | 878 | "1.0", "SHA256SUMS") | 879 | "1.0", "SHA256SUMS") |
1442 | @@ -888,9 +889,9 @@ | |||
1443 | 888 | self.setUpKmodKeys() | 889 | self.setUpKmodKeys() |
1444 | 889 | self.setUpOpalKeys() | 890 | self.setUpOpalKeys() |
1445 | 890 | self.openArchive("test", "1.0", "amd64") | 891 | self.openArchive("test", "1.0", "amd64") |
1449 | 891 | self.tarfile.add_file("1.0/empty.efi", "") | 892 | self.tarfile.add_file("1.0/empty.efi", b"") |
1450 | 892 | self.tarfile.add_file("1.0/empty.ko", "") | 893 | self.tarfile.add_file("1.0/empty.ko", b"") |
1451 | 893 | self.tarfile.add_file("1.0/empty.opal", "") | 894 | self.tarfile.add_file("1.0/empty.opal", b"") |
1452 | 894 | self.process_emulate() | 895 | self.process_emulate() |
1453 | 895 | sha256file = os.path.join(self.getSignedPath("test", "amd64"), | 896 | sha256file = os.path.join(self.getSignedPath("test", "amd64"), |
1454 | 896 | "1.0", "SHA256SUMS") | 897 | "1.0", "SHA256SUMS") |
1455 | @@ -907,10 +908,10 @@ | |||
1456 | 907 | self.setUpKmodKeys() | 908 | self.setUpKmodKeys() |
1457 | 908 | self.setUpOpalKeys() | 909 | self.setUpOpalKeys() |
1458 | 909 | self.openArchive("test", "1.0", "amd64") | 910 | self.openArchive("test", "1.0", "amd64") |
1463 | 910 | self.tarfile.add_file("1.0/control/options", "tarball") | 911 | self.tarfile.add_file("1.0/control/options", b"tarball") |
1464 | 911 | self.tarfile.add_file("1.0/empty.efi", "") | 912 | self.tarfile.add_file("1.0/empty.efi", b"") |
1465 | 912 | self.tarfile.add_file("1.0/empty.ko", "") | 913 | self.tarfile.add_file("1.0/empty.ko", b"") |
1466 | 913 | self.tarfile.add_file("1.0/empty.opal", "") | 914 | self.tarfile.add_file("1.0/empty.opal", b"") |
1467 | 914 | self.process_emulate() | 915 | self.process_emulate() |
1468 | 915 | sha256file = os.path.join(self.getSignedPath("test", "amd64"), | 916 | sha256file = os.path.join(self.getSignedPath("test", "amd64"), |
1469 | 916 | "1.0", "SHA256SUMS") | 917 | "1.0", "SHA256SUMS") |
1470 | @@ -951,7 +952,7 @@ | |||
1471 | 951 | # Files in the tarball are installed correctly. | 952 | # Files in the tarball are installed correctly. |
1472 | 952 | self.setUpUefiKeys() | 953 | self.setUpUefiKeys() |
1473 | 953 | self.openArchive("test", "1.0", "amd64") | 954 | self.openArchive("test", "1.0", "amd64") |
1475 | 954 | self.tarfile.add_file("1.0/empty.efi", "") | 955 | self.tarfile.add_file("1.0/empty.efi", b"") |
1476 | 955 | self.process() | 956 | self.process() |
1477 | 956 | self.assertTrue(os.path.isdir(os.path.join( | 957 | self.assertTrue(os.path.isdir(os.path.join( |
1478 | 957 | self.getDistsPath(), "uefi"))) | 958 | self.getDistsPath(), "uefi"))) |