Merge lp:~cjwatson/launchpad/archivepublisher-tests-future-imports into lp:launchpad

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
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+337053@code.launchpad.net

Commit message

Convert lp.archivepublisher.tests to Launchpad's preferred __future__ imports.

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
=== modified file 'lib/lp/archivepublisher/tests/__init__.py'
--- lib/lp/archivepublisher/tests/__init__.py 2010-08-20 20:31:18 +0000
+++ lib/lp/archivepublisher/tests/__init__.py 2018-02-02 11:57:41 +0000
@@ -1,6 +1,8 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the1# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4from __future__ import absolute_import, print_function, unicode_literals
5
4import os6import os
57
68
79
=== modified file 'lib/lp/archivepublisher/tests/test_archivesigningkey.py'
--- lib/lp/archivepublisher/tests/test_archivesigningkey.py 2017-04-29 15:24:32 +0000
+++ lib/lp/archivepublisher/tests/test_archivesigningkey.py 2018-02-02 11:57:41 +0000
@@ -1,8 +1,10 @@
1# Copyright 2016-2017 Canonical Ltd. This software is licensed under the1# Copyright 2016-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Test ArchiveSigningKey."""4"""Test ArchiveSigningKey."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8import os10import os
911
=== modified file 'lib/lp/archivepublisher/tests/test_config.py'
--- lib/lp/archivepublisher/tests/test_config.py 2016-05-04 14:49:37 +0000
+++ lib/lp/archivepublisher/tests/test_config.py 2018-02-02 11:57:41 +0000
@@ -1,4 +1,4 @@
1# Copyright 2011-2016 Canonical Ltd. This software is licensed under the1# Copyright 2011-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Test publisher configs handling.4"""Test publisher configs handling.
@@ -6,6 +6,8 @@
6Publisher configuration provides archive-dependent filesystem paths.6Publisher configuration provides archive-dependent filesystem paths.
7"""7"""
88
9from __future__ import absolute_import, print_function, unicode_literals
10
9__metaclass__ = type11__metaclass__ = type
1012
11import os13import os
1214
=== modified file 'lib/lp/archivepublisher/tests/test_customupload.py'
--- lib/lp/archivepublisher/tests/test_customupload.py 2012-05-28 13:13:53 +0000
+++ lib/lp/archivepublisher/tests/test_customupload.py 2018-02-02 11:57:41 +0000
@@ -1,8 +1,10 @@
1# Copyright 2009-2012 Canonical Ltd. This software is licensed under the1# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Tests for `CustomUploads`."""4"""Tests for `CustomUploads`."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
810
911
=== modified file 'lib/lp/archivepublisher/tests/test_ddtp_tarball.py'
--- lib/lp/archivepublisher/tests/test_ddtp_tarball.py 2016-06-07 17:07:35 +0000
+++ lib/lp/archivepublisher/tests/test_ddtp_tarball.py 2018-02-02 11:57:41 +0000
@@ -1,4 +1,4 @@
1# Copyright 2012-2016 Canonical Ltd. This software is licensed under the1# Copyright 2012-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Test ddtp-tarball custom uploads.4"""Test ddtp-tarball custom uploads.
@@ -7,6 +7,8 @@
7tests of ddtp-tarball upload and queue manipulation.7tests of ddtp-tarball upload and queue manipulation.
8"""8"""
99
10from __future__ import absolute_import, print_function, unicode_literals
11
10import os12import os
1113
12from zope.component import getUtility14from zope.component import getUtility
@@ -57,7 +59,7 @@
57 def test_basic(self):59 def test_basic(self):
58 # Processing a simple correct tar file works.60 # Processing a simple correct tar file works.
59 self.openArchive("20060728")61 self.openArchive("20060728")
60 self.tarfile.add_file("i18n/Translation-de", "")62 self.tarfile.add_file("i18n/Translation-de", b"")
61 self.process()63 self.process()
62 self.assertTrue(os.path.exists(64 self.assertTrue(os.path.exists(
63 self.getTranslationsPath("Translation-de")))65 self.getTranslationsPath("Translation-de")))
@@ -65,7 +67,7 @@
65 def test_ignores_empty_directories(self):67 def test_ignores_empty_directories(self):
66 # Empty directories in the tarball are not extracted.68 # Empty directories in the tarball are not extracted.
67 self.openArchive("20060728")69 self.openArchive("20060728")
68 self.tarfile.add_file("i18n/Translation-de", "")70 self.tarfile.add_file("i18n/Translation-de", b"")
69 self.tarfile.add_directory("i18n/foo")71 self.tarfile.add_directory("i18n/foo")
70 self.process()72 self.process()
71 self.assertTrue(os.path.exists(73 self.assertTrue(os.path.exists(
@@ -76,15 +78,15 @@
76 # If a DDTP tarball only contains a subset of published translation78 # If a DDTP tarball only contains a subset of published translation
77 # files, these are updated and the rest are left untouched.79 # files, these are updated and the rest are left untouched.
78 self.openArchive("20060728")80 self.openArchive("20060728")
79 self.tarfile.add_file("i18n/Translation-bn", "bn")81 self.tarfile.add_file("i18n/Translation-bn", b"bn")
80 self.tarfile.add_file("i18n/Translation-ca", "ca")82 self.tarfile.add_file("i18n/Translation-ca", b"ca")
81 self.process()83 self.process()
82 with open(self.getTranslationsPath("Translation-bn")) as bn_file:84 with open(self.getTranslationsPath("Translation-bn")) as bn_file:
83 self.assertEqual("bn", bn_file.read())85 self.assertEqual("bn", bn_file.read())
84 with open(self.getTranslationsPath("Translation-ca")) as ca_file:86 with open(self.getTranslationsPath("Translation-ca")) as ca_file:
85 self.assertEqual("ca", ca_file.read())87 self.assertEqual("ca", ca_file.read())
86 self.openArchive("20060817")88 self.openArchive("20060817")
87 self.tarfile.add_file("i18n/Translation-bn", "new bn")89 self.tarfile.add_file("i18n/Translation-bn", b"new bn")
88 self.process()90 self.process()
89 with open(self.getTranslationsPath("Translation-bn")) as bn_file:91 with open(self.getTranslationsPath("Translation-bn")) as bn_file:
90 self.assertEqual("new bn", bn_file.read())92 self.assertEqual("new bn", bn_file.read())
@@ -98,7 +100,7 @@
98 # into place, so making this work requires special care. Test that100 # into place, so making this work requires special care. Test that
99 # that care has been taken.101 # that care has been taken.
100 self.openArchive("20060728")102 self.openArchive("20060728")
101 self.tarfile.add_file("i18n/Translation-ca", "")103 self.tarfile.add_file("i18n/Translation-ca", b"")
102 self.process()104 self.process()
103 ca = self.getTranslationsPath("Translation-ca")105 ca = self.getTranslationsPath("Translation-ca")
104 bn = self.getTranslationsPath("Translation-bn")106 bn = self.getTranslationsPath("Translation-bn")
@@ -107,7 +109,7 @@
107 self.assertEqual(2, os.stat(bn).st_nlink)109 self.assertEqual(2, os.stat(bn).st_nlink)
108 self.assertEqual(2, os.stat(ca).st_nlink)110 self.assertEqual(2, os.stat(ca).st_nlink)
109 self.openArchive("20060817")111 self.openArchive("20060817")
110 self.tarfile.add_file("i18n/Translation-bn", "break hard link")112 self.tarfile.add_file("i18n/Translation-bn", b"break hard link")
111 self.process()113 self.process()
112 with open(bn) as bn_file:114 with open(bn) as bn_file:
113 self.assertEqual("break hard link", bn_file.read())115 self.assertEqual("break hard link", bn_file.read())
114116
=== modified file 'lib/lp/archivepublisher/tests/test_deathrow.py'
--- lib/lp/archivepublisher/tests/test_deathrow.py 2016-09-24 06:21:55 +0000
+++ lib/lp/archivepublisher/tests/test_deathrow.py 2018-02-02 11:57:41 +0000
@@ -1,8 +1,10 @@
1# Copyright 2009-2010 Canonical Ltd. This software is licensed under the1# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Tests for deathrow class."""4"""Tests for deathrow class."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
810
911
=== modified file 'lib/lp/archivepublisher/tests/test_debian_installer.py'
--- lib/lp/archivepublisher/tests/test_debian_installer.py 2016-06-07 17:07:35 +0000
+++ lib/lp/archivepublisher/tests/test_debian_installer.py 2018-02-02 11:57:41 +0000
@@ -1,4 +1,4 @@
1# Copyright 2012-2016 Canonical Ltd. This software is licensed under the1# Copyright 2012-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Test debian-installer custom uploads.4"""Test debian-installer custom uploads.
@@ -7,6 +7,8 @@
7high-level tests of debian-installer upload and queue manipulation.7high-level tests of debian-installer upload and queue manipulation.
8"""8"""
99
10from __future__ import absolute_import, print_function, unicode_literals
11
10import os12import os
1113
12from zope.component import getUtility14from zope.component import getUtility
@@ -77,7 +79,7 @@
77 def test_basic(self):79 def test_basic(self):
78 # Processing a simple correct tar file succeeds.80 # Processing a simple correct tar file succeeds.
79 self.openArchive()81 self.openArchive()
80 self.addFile("hello", "world")82 self.addFile("hello", b"world")
81 self.process()83 self.process()
8284
83 def test_already_exists(self):85 def test_already_exists(self):
@@ -89,14 +91,14 @@
89 def test_bad_umask(self):91 def test_bad_umask(self):
90 # The umask must be 0o022 to avoid incorrect permissions.92 # The umask must be 0o022 to avoid incorrect permissions.
91 self.openArchive()93 self.openArchive()
92 self.addFile("dir/file", "foo")94 self.addFile("dir/file", b"foo")
93 os.umask(0o002) # cleanup already handled by setUp95 os.umask(0o002) # cleanup already handled by setUp
94 self.assertRaises(CustomUploadBadUmask, self.process)96 self.assertRaises(CustomUploadBadUmask, self.process)
9597
96 def test_current_symlink(self):98 def test_current_symlink(self):
97 # A "current" symlink is created to the last version.99 # A "current" symlink is created to the last version.
98 self.openArchive()100 self.openArchive()
99 self.addFile("hello", "world")101 self.addFile("hello", b"world")
100 self.process()102 self.process()
101 installer_path = self.getInstallerPath()103 installer_path = self.getInstallerPath()
102 self.assertContentEqual(104 self.assertContentEqual(
@@ -112,8 +114,8 @@
112 filename = os.path.join(directory, "default")114 filename = os.path.join(directory, "default")
113 long_filename = os.path.join(115 long_filename = os.path.join(
114 directory, "very_very_very_very_very_very_long_filename")116 directory, "very_very_very_very_very_very_long_filename")
115 self.addFile(filename, "hey")117 self.addFile(filename, b"hey")
116 self.addFile(long_filename, "long")118 self.addFile(long_filename, b"long")
117 self.process()119 self.process()
118 with open(self.getInstallerPath(filename)) as f:120 with open(self.getInstallerPath(filename)) as f:
119 self.assertEqual("hey", f.read())121 self.assertEqual("hey", f.read())
@@ -140,7 +142,7 @@
140 def test_top_level_permissions(self):142 def test_top_level_permissions(self):
141 # Top-level directories are set to mode 0o755 (see bug 107068).143 # Top-level directories are set to mode 0o755 (see bug 107068).
142 self.openArchive()144 self.openArchive()
143 self.addFile("hello", "world")145 self.addFile("hello", b"world")
144 self.process()146 self.process()
145 installer_path = self.getInstallerPath()147 installer_path = self.getInstallerPath()
146 self.assertEqual(0o755, os.stat(installer_path).st_mode & 0o777)148 self.assertEqual(0o755, os.stat(installer_path).st_mode & 0o777)
@@ -154,7 +156,7 @@
154 directory = ("images/netboot/ubuntu-installer/i386/"156 directory = ("images/netboot/ubuntu-installer/i386/"
155 "pxelinux.cfg.serial-9600")157 "pxelinux.cfg.serial-9600")
156 filename = os.path.join(directory, "default")158 filename = os.path.join(directory, "default")
157 self.addFile(filename, "hey")159 self.addFile(filename, b"hey")
158 self.process()160 self.process()
159 self.assertEqual(161 self.assertEqual(
160 0o644, os.stat(self.getInstallerPath(filename)).st_mode & 0o777)162 0o644, os.stat(self.getInstallerPath(filename)).st_mode & 0o777)
161163
=== modified file 'lib/lp/archivepublisher/tests/test_debversion.py'
--- lib/lp/archivepublisher/tests/test_debversion.py 2018-01-02 16:10:26 +0000
+++ lib/lp/archivepublisher/tests/test_debversion.py 2018-02-02 11:57:41 +0000
@@ -1,8 +1,10 @@
1# Copyright 2009-2010 Canonical Ltd. This software is licensed under the1# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Tests for debversion."""4"""Tests for debversion."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8# These tests came from sourcerer.10# These tests came from sourcerer.
911
=== modified file 'lib/lp/archivepublisher/tests/test_dist_upgrader.py'
--- lib/lp/archivepublisher/tests/test_dist_upgrader.py 2016-06-07 17:07:35 +0000
+++ lib/lp/archivepublisher/tests/test_dist_upgrader.py 2018-02-02 11:57:41 +0000
@@ -1,4 +1,4 @@
1# Copyright 2012-2016 Canonical Ltd. This software is licensed under the1# Copyright 2012-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Test dist-upgrader custom uploads.4"""Test dist-upgrader custom uploads.
@@ -7,6 +7,8 @@
7tests of dist-upgrader upload and queue manipulation.7tests of dist-upgrader upload and queue manipulation.
8"""8"""
99
10from __future__ import absolute_import, print_function, unicode_literals
11
10import os12import os
1113
12from zope.component import getUtility14from zope.component import getUtility
@@ -71,27 +73,27 @@
71 def test_basic(self):73 def test_basic(self):
72 # Processing a simple correct tar file works.74 # Processing a simple correct tar file works.
73 self.openArchive("20060302.0120")75 self.openArchive("20060302.0120")
74 self.tarfile.add_file("20060302.0120/hello", "world")76 self.tarfile.add_file("20060302.0120/hello", b"world")
75 self.process()77 self.process()
7678
77 def test_already_exists(self):79 def test_already_exists(self):
78 # If the target directory already exists, processing fails.80 # If the target directory already exists, processing fails.
79 self.openArchive("20060302.0120")81 self.openArchive("20060302.0120")
80 self.tarfile.add_file("20060302.0120/hello", "world")82 self.tarfile.add_file("20060302.0120/hello", b"world")
81 os.makedirs(os.path.join(self.getUpgraderPath(), "20060302.0120"))83 os.makedirs(os.path.join(self.getUpgraderPath(), "20060302.0120"))
82 self.assertRaises(CustomUploadAlreadyExists, self.process)84 self.assertRaises(CustomUploadAlreadyExists, self.process)
8385
84 def test_bad_umask(self):86 def test_bad_umask(self):
85 # The umask must be 0o022 to avoid incorrect permissions.87 # The umask must be 0o022 to avoid incorrect permissions.
86 self.openArchive("20060302.0120")88 self.openArchive("20060302.0120")
87 self.tarfile.add_file("20060302.0120/file", "foo")89 self.tarfile.add_file("20060302.0120/file", b"foo")
88 os.umask(0o002) # cleanup already handled by setUp90 os.umask(0o002) # cleanup already handled by setUp
89 self.assertRaises(CustomUploadBadUmask, self.process)91 self.assertRaises(CustomUploadBadUmask, self.process)
9092
91 def test_current_symlink(self):93 def test_current_symlink(self):
92 # A "current" symlink is created to the last version.94 # A "current" symlink is created to the last version.
93 self.openArchive("20060302.0120")95 self.openArchive("20060302.0120")
94 self.tarfile.add_file("20060302.0120/hello", "world")96 self.tarfile.add_file("20060302.0120/hello", b"world")
95 self.process()97 self.process()
96 upgrader_path = self.getUpgraderPath()98 upgrader_path = self.getUpgraderPath()
97 self.assertContentEqual(99 self.assertContentEqual(
@@ -106,7 +108,7 @@
106 def test_bad_version(self):108 def test_bad_version(self):
107 # Bad versions in the tarball are refused.109 # Bad versions in the tarball are refused.
108 self.openArchive("20070219.1234")110 self.openArchive("20070219.1234")
109 self.tarfile.add_file("foobar/foobar/dapper.tar.gz", "")111 self.tarfile.add_file("foobar/foobar/dapper.tar.gz", b"")
110 self.assertRaises(DistUpgraderBadVersion, self.process)112 self.assertRaises(DistUpgraderBadVersion, self.process)
111113
112 def test_getSeriesKey_extracts_architecture(self):114 def test_getSeriesKey_extracts_architecture(self):
113115
=== modified file 'lib/lp/archivepublisher/tests/test_dominator.py'
--- lib/lp/archivepublisher/tests/test_dominator.py 2014-10-31 10:34:51 +0000
+++ lib/lp/archivepublisher/tests/test_dominator.py 2018-02-02 11:57:41 +0000
@@ -1,8 +1,10 @@
1# Copyright 2009-2011 Canonical Ltd. This software is licensed under the1# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Tests for domination.py."""4"""Tests for domination.py."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8import datetime10import datetime
911
=== modified file 'lib/lp/archivepublisher/tests/test_ftparchive.py'
--- lib/lp/archivepublisher/tests/test_ftparchive.py 2017-01-13 12:28:34 +0000
+++ lib/lp/archivepublisher/tests/test_ftparchive.py 2018-02-02 11:57:41 +0000
@@ -1,8 +1,10 @@
1# Copyright 2009-2017 Canonical Ltd. This software is licensed under the1# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Tests for ftparchive.py"""4"""Tests for ftparchive.py"""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8import difflib10import difflib
@@ -254,7 +256,7 @@
254 extra_overrides = os.path.join(256 extra_overrides = os.path.join(
255 self._confdir, "more-extra.override.hoary-test.main")257 self._confdir, "more-extra.override.hoary-test.main")
256 with open(extra_overrides, "w") as extra_override_file:258 with open(extra_overrides, "w") as extra_override_file:
257 print >>extra_override_file, " ".join(sentinel)259 print(" ".join(sentinel), file=extra_override_file)
258 self._publishDefaultOverrides(fa, 'universe')260 self._publishDefaultOverrides(fa, 'universe')
259261
260 result_path = os.path.join(262 result_path = os.path.join(
@@ -332,7 +334,7 @@
332 self._publisher = SamplePublisher(self._archive)334 self._publisher = SamplePublisher(self._archive)
333 fa = self._setUpFTPArchiveHandler()335 fa = self._setUpFTPArchiveHandler()
334 pubs = self._archive.getAllPublishedBinaries(336 pubs = self._archive.getAllPublishedBinaries(
335 name=u"pmount", status=PackagePublishingStatus.PUBLISHED,337 name="pmount", status=PackagePublishingStatus.PUBLISHED,
336 distroarchseries=self._distribution.getSeries("hoary")["hppa"])338 distroarchseries=self._distribution.getSeries("hoary")["hppa"])
337 for pub in pubs:339 for pub in pubs:
338 pub.changeOverride(new_phased_update_percentage=30).setPublished()340 pub.changeOverride(new_phased_update_percentage=30).setPublished()
@@ -377,10 +379,10 @@
377379
378 def makeDDEBPub(self, series):380 def makeDDEBPub(self, series):
379 self.factory.makeBinaryPackagePublishingHistory(381 self.factory.makeBinaryPackagePublishingHistory(
380 binarypackagename=u'foo', sourcepackagename='foo', version='666',382 binarypackagename='foo', sourcepackagename='foo', version='666',
381 archive=series.main_archive, distroarchseries=series['hppa'],383 archive=series.main_archive, distroarchseries=series['hppa'],
382 pocket=PackagePublishingPocket.RELEASE,384 pocket=PackagePublishingPocket.RELEASE,
383 component=u'main', with_debug=True, with_file=True,385 component='main', with_debug=True, with_file=True,
384 status=PackagePublishingStatus.PUBLISHED,386 status=PackagePublishingStatus.PUBLISHED,
385 architecturespecific=True)387 architecturespecific=True)
386388
387389
=== modified file 'lib/lp/archivepublisher/tests/test_generate_contents_files.py'
--- lib/lp/archivepublisher/tests/test_generate_contents_files.py 2016-11-01 10:28:15 +0000
+++ lib/lp/archivepublisher/tests/test_generate_contents_files.py 2018-02-02 11:57:41 +0000
@@ -1,8 +1,10 @@
1# Copyright 2011-2016 Canonical Ltd. This software is licensed under the1# Copyright 2011-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Test for the `generate-contents-files` script."""4"""Test for the `generate-contents-files` script."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8import hashlib10import hashlib
911
=== modified file 'lib/lp/archivepublisher/tests/test_generate_ppa_htaccess.py'
--- lib/lp/archivepublisher/tests/test_generate_ppa_htaccess.py 2016-07-14 14:12:23 +0000
+++ lib/lp/archivepublisher/tests/test_generate_ppa_htaccess.py 2018-02-02 11:57:41 +0000
@@ -1,8 +1,10 @@
1# Copyright 2009-2015 Canonical Ltd. This software is licensed under the1# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Test the generate_ppa_htaccess.py script. """4"""Test the generate_ppa_htaccess.py script. """
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6import crypt8import crypt
7from datetime import (9from datetime import (
8 datetime,10 datetime,
@@ -75,7 +77,7 @@
75 self.ppa.distribution = ubuntutest77 self.ppa.distribution = ubuntutest
7678
77 # Enable named auth tokens.79 # Enable named auth tokens.
78 self.useFixture(FeatureFixture({NAMED_AUTH_TOKEN_FEATURE_FLAG: u"on"}))80 self.useFixture(FeatureFixture({NAMED_AUTH_TOKEN_FEATURE_FLAG: "on"}))
7981
80 def getScript(self, test_args=None):82 def getScript(self, test_args=None):
81 """Return a HtaccessTokenGenerator instance."""83 """Return a HtaccessTokenGenerator instance."""
@@ -266,8 +268,8 @@
266 team1_person = persons1[0]268 team1_person = persons1[0]
267269
268 # Named tokens should be ignored for deactivation.270 # Named tokens should be ignored for deactivation.
269 self.ppa.newNamedAuthToken(u"tokenname1")271 self.ppa.newNamedAuthToken("tokenname1")
270 named_token = self.ppa.newNamedAuthToken(u"tokenname2")272 named_token = self.ppa.newNamedAuthToken("tokenname2")
271 named_token.deactivate()273 named_token.deactivate()
272274
273 # Initially, nothing is eligible for deactivation.275 # Initially, nothing is eligible for deactivation.
@@ -335,7 +337,7 @@
335 sub2 = self.ppa.newSubscription(name16, self.ppa.owner)337 sub2 = self.ppa.newSubscription(name16, self.ppa.owner)
336 token1 = self.ppa.newAuthToken(name12)338 token1 = self.ppa.newAuthToken(name12)
337 token2 = self.ppa.newAuthToken(name16)339 token2 = self.ppa.newAuthToken(name16)
338 token3 = self.ppa.newNamedAuthToken(u"tokenname3")340 token3 = self.ppa.newNamedAuthToken("tokenname3")
339 self.layer.txn.commit()341 self.layer.txn.commit()
340 return (sub1, sub2), (token1, token2, token3)342 return (sub1, sub2), (token1, token2, token3)
341343
@@ -384,9 +386,9 @@
384386
385 def testBasicOperation_with_named_tokens(self):387 def testBasicOperation_with_named_tokens(self):
386 """Invoke the actual script and make sure it generates some files."""388 """Invoke the actual script and make sure it generates some files."""
387 token1 = self.ppa.newNamedAuthToken(u"tokenname1")389 token1 = self.ppa.newNamedAuthToken("tokenname1")
388 token2 = self.ppa.newNamedAuthToken(u"tokenname2")390 token2 = self.ppa.newNamedAuthToken("tokenname2")
389 token3 = self.ppa.newNamedAuthToken(u"tokenname3")391 token3 = self.ppa.newNamedAuthToken("tokenname3")
390 token3.deactivate()392 token3.deactivate()
391393
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.
@@ -641,10 +643,10 @@
641 last_start = datetime.now(pytz.UTC) - timedelta(seconds=90)643 last_start = datetime.now(pytz.UTC) - timedelta(seconds=90)
642 before_last_start = last_start - timedelta(seconds=30)644 before_last_start = last_start - timedelta(seconds=30)
643645
644 self.ppa.newNamedAuthToken(u"tokenname1")646 self.ppa.newNamedAuthToken("tokenname1")
645 token2 = self.ppa.newNamedAuthToken(u"tokenname2")647 token2 = self.ppa.newNamedAuthToken("tokenname2")
646 token2.deactivate()648 token2.deactivate()
647 token3 = self.ppa.newNamedAuthToken(u"tokenname3")649 token3 = self.ppa.newNamedAuthToken("tokenname3")
648 token3.date_deactivated = before_last_start650 token3.date_deactivated = before_last_start
649651
650 script = self.getScript()652 script = self.getScript()
@@ -657,12 +659,12 @@
657 before_last_start = last_start - timedelta(seconds=30)659 before_last_start = last_start - timedelta(seconds=30)
658 tomorrow = datetime.now(pytz.UTC) + timedelta(days=1)660 tomorrow = datetime.now(pytz.UTC) + timedelta(days=1)
659661
660 self.ppa.newNamedAuthToken(u"tokenname1")662 self.ppa.newNamedAuthToken("tokenname1")
661 token2 = self.ppa.newNamedAuthToken(u"tokenname2")663 token2 = self.ppa.newNamedAuthToken("tokenname2")
662 token2.deactivate()664 token2.deactivate()
663 token3 = self.ppa.newNamedAuthToken(u"tokenname3")665 token3 = self.ppa.newNamedAuthToken("tokenname3")
664 token3.date_deactivated = before_last_start666 token3.date_deactivated = before_last_start
665 token4 = self.ppa.newNamedAuthToken(u"tokenname4")667 token4 = self.ppa.newNamedAuthToken("tokenname4")
666 token4.date_deactivated = tomorrow668 token4.date_deactivated = tomorrow
667669
668 script = self.getScript()670 script = self.getScript()
669671
=== modified file 'lib/lp/archivepublisher/tests/test_htaccess.py'
--- lib/lp/archivepublisher/tests/test_htaccess.py 2018-01-02 16:10:26 +0000
+++ lib/lp/archivepublisher/tests/test_htaccess.py 2018-02-02 11:57:41 +0000
@@ -1,8 +1,10 @@
1# Copyright 2009-2017 Canonical Ltd. This software is licensed under the1# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Test htaccess/htpasswd file generation. """4"""Test htaccess/htpasswd file generation. """
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6import os8import os
7import tempfile9import tempfile
810
@@ -39,7 +41,7 @@
39 self.ppa.distribution = ubuntutest41 self.ppa.distribution = ubuntutest
4042
41 # Enable named auth tokens.43 # Enable named auth tokens.
42 self.useFixture(FeatureFixture({NAMED_AUTH_TOKEN_FEATURE_FLAG: u"on"}))44 self.useFixture(FeatureFixture({NAMED_AUTH_TOKEN_FEATURE_FLAG: "on"}))
4345
44 def test_write_htpasswd(self):46 def test_write_htpasswd(self):
45 """Test that writing the .htpasswd file works properly."""47 """Test that writing the .htpasswd file works properly."""
@@ -118,9 +120,9 @@
118 first_created_token = self.ppa.newAuthToken(name16)120 first_created_token = self.ppa.newAuthToken(name16)
119 second_created_token = self.ppa.newAuthToken(name12)121 second_created_token = self.ppa.newAuthToken(name12)
120 third_created_token = self.ppa.newAuthToken(hyphenated)122 third_created_token = self.ppa.newAuthToken(hyphenated)
121 named_token_20 = self.ppa.newNamedAuthToken(u"name20", as_dict=False)123 named_token_20 = self.ppa.newNamedAuthToken("name20", as_dict=False)
122 named_token_14 = self.ppa.newNamedAuthToken(u"name14", as_dict=False)124 named_token_14 = self.ppa.newNamedAuthToken("name14", as_dict=False)
123 named_token_99 = self.ppa.newNamedAuthToken(u"name99", as_dict=False)125 named_token_99 = self.ppa.newNamedAuthToken("name99", as_dict=False)
124 named_token_99.deactivate()126 named_token_99.deactivate()
125127
126 expected_credentials = [128 expected_credentials = [
127129
=== modified file 'lib/lp/archivepublisher/tests/test_indices.py'
--- lib/lp/archivepublisher/tests/test_indices.py 2016-02-05 15:16:29 +0000
+++ lib/lp/archivepublisher/tests/test_indices.py 2018-02-02 11:57:41 +0000
@@ -1,8 +1,10 @@
1# Copyright 2009-2013 Canonical Ltd. This software is licensed under the1# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Test native archive index generation for Soyuz."""4"""Test native archive index generation for Soyuz."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6import os8import os
7import tempfile9import tempfile
8import unittest10import unittest
@@ -70,27 +72,27 @@
70 ("Build-Conflicts-Arch", "libbar-dev")])72 ("Build-Conflicts-Arch", "libbar-dev")])
7173
72 self.assertEqual(74 self.assertEqual(
73 [u'Package: foo',75 ['Package: foo',
74 u'Binary: foo-bin',76 'Binary: foo-bin',
75 u'Version: 666',77 'Version: 666',
76 u'Section: base',78 'Section: base',
77 u'Maintainer: Foo Bar <foo@bar.com>',79 'Maintainer: Foo Bar <foo@bar.com>',
78 u'Build-Depends: fooish',80 'Build-Depends: fooish',
79 u'Build-Depends-Indep: pyfoo',81 'Build-Depends-Indep: pyfoo',
80 u'Build-Depends-Arch: libfoo-dev',82 'Build-Depends-Arch: libfoo-dev',
81 u'Build-Conflicts: bar',83 'Build-Conflicts: bar',
82 u'Build-Conflicts-Indep: pybar',84 'Build-Conflicts-Indep: pybar',
83 u'Build-Conflicts-Arch: libbar-dev',85 'Build-Conflicts-Arch: libbar-dev',
84 u'Architecture: all',86 'Architecture: all',
85 u'Standards-Version: 3.6.2',87 'Standards-Version: 3.6.2',
86 u'Format: 1.0',88 'Format: 1.0',
87 u'Directory: pool/main/f/foo',89 'Directory: pool/main/f/foo',
88 u'Files:',90 'Files:',
89 u' %s 28 foo_666.dsc' % self.dsc_md5,91 ' %s 28 foo_666.dsc' % self.dsc_md5,
90 u'Checksums-Sha1:',92 'Checksums-Sha1:',
91 u' %s 28 foo_666.dsc' % self.dsc_sha1,93 ' %s 28 foo_666.dsc' % self.dsc_sha1,
92 u'Checksums-Sha256:',94 'Checksums-Sha256:',
93 u' %s 28 foo_666.dsc' % self.dsc_sha256,95 ' %s 28 foo_666.dsc' % self.dsc_sha256,
94 ],96 ],
95 build_spph_stanza(pub_source).makeOutput().splitlines())97 build_spph_stanza(pub_source).makeOutput().splitlines())
9698
@@ -112,28 +114,28 @@
112 ("Build-Conflicts-Arch", "libbar-dev")])114 ("Build-Conflicts-Arch", "libbar-dev")])
113115
114 self.assertEqual(116 self.assertEqual(
115 [u'Package: foo',117 ['Package: foo',
116 u'Binary: foo-bin',118 'Binary: foo-bin',
117 u'Version: 666',119 'Version: 666',
118 u'Section: base',120 'Section: base',
119 u'Maintainer: Foo Bar <foo@bar.com>',121 'Maintainer: Foo Bar <foo@bar.com>',
120 u'Build-Depends: fooish',122 'Build-Depends: fooish',
121 u'Build-Depends-Indep: pyfoo',123 'Build-Depends-Indep: pyfoo',
122 u'Build-Depends-Arch: libfoo-dev',124 'Build-Depends-Arch: libfoo-dev',
123 u'Build-Conflicts: bar',125 'Build-Conflicts: bar',
124 u'Build-Conflicts-Indep: pybar',126 'Build-Conflicts-Indep: pybar',
125 u'Build-Conflicts-Arch: libbar-dev',127 'Build-Conflicts-Arch: libbar-dev',
126 u'Architecture: all',128 'Architecture: all',
127 u'Standards-Version: 3.6.2',129 'Standards-Version: 3.6.2',
128 u'Format: 1.0',130 'Format: 1.0',
129 u'Directory: pool/main/f/foo',131 'Directory: pool/main/f/foo',
130 u'Files:',132 'Files:',
131 u' %s 28 foo_666.dsc' % self.dsc_md5,133 ' %s 28 foo_666.dsc' % self.dsc_md5,
132 u'Checksums-Sha1:',134 'Checksums-Sha1:',
133 u' %s 28 foo_666.dsc' % self.dsc_sha1,135 ' %s 28 foo_666.dsc' % self.dsc_sha1,
134 u'Checksums-Sha256:',136 'Checksums-Sha256:',
135 u' %s 28 foo_666.dsc' % self.dsc_sha256,137 ' %s 28 foo_666.dsc' % self.dsc_sha256,
136 u'Python-Version: < 1.5'],138 'Python-Version: < 1.5'],
137 build_spph_stanza(pub_source).makeOutput().splitlines())139 build_spph_stanza(pub_source).makeOutput().splitlines())
138140
139 def testBinaryStanza(self):141 def testBinaryStanza(self):
@@ -149,32 +151,32 @@
149 phased_update_percentage=50)151 phased_update_percentage=50)
150 pub_binary = pub_binaries[0]152 pub_binary = pub_binaries[0]
151 self.assertEqual(153 self.assertEqual(
152 [u'Package: foo-bin',154 ['Package: foo-bin',
153 u'Source: foo',155 'Source: foo',
154 u'Priority: standard',156 'Priority: standard',
155 u'Section: base',157 'Section: base',
156 u'Installed-Size: 100',158 'Installed-Size: 100',
157 u'Maintainer: Foo Bar <foo@bar.com>',159 'Maintainer: Foo Bar <foo@bar.com>',
158 u'Architecture: all',160 'Architecture: all',
159 u'Version: 666',161 'Version: 666',
160 u'Recommends: foo-dev',162 'Recommends: foo-dev',
161 u'Replaces: old-foo',163 'Replaces: old-foo',
162 u'Suggests: pyfoo',164 'Suggests: pyfoo',
163 u'Provides: foo-master',165 'Provides: foo-master',
164 u'Depends: biscuit',166 'Depends: biscuit',
165 u'Conflicts: old-foo',167 'Conflicts: old-foo',
166 u'Pre-Depends: master-foo',168 'Pre-Depends: master-foo',
167 u'Enhances: foo-super',169 'Enhances: foo-super',
168 u'Breaks: old-foo',170 'Breaks: old-foo',
169 u'Filename: pool/main/f/foo/foo-bin_666_all.deb',171 'Filename: pool/main/f/foo/foo-bin_666_all.deb',
170 u'Size: 18',172 'Size: 18',
171 u'MD5sum: ' + self.deb_md5,173 'MD5sum: ' + self.deb_md5,
172 u'SHA1: ' + self.deb_sha1,174 'SHA1: ' + self.deb_sha1,
173 u'SHA256: ' + self.deb_sha256,175 'SHA256: ' + self.deb_sha256,
174 u'Phased-Update-Percentage: 50',176 'Phased-Update-Percentage: 50',
175 u'Description: Foo app is great',177 'Description: Foo app is great',
176 u' Well ...',178 ' Well ...',
177 u' it does nothing, though'],179 ' it does nothing, though'],
178 build_bpph_stanza(pub_binary).makeOutput().splitlines())180 build_bpph_stanza(pub_binary).makeOutput().splitlines())
179181
180 def testBinaryStanzaWithCustomFields(self):182 def testBinaryStanzaWithCustomFields(self):
@@ -189,32 +191,32 @@
189 user_defined_fields=[("Python-Version", ">= 2.4")])191 user_defined_fields=[("Python-Version", ">= 2.4")])
190 pub_binary = pub_binaries[0]192 pub_binary = pub_binaries[0]
191 self.assertEqual(193 self.assertEqual(
192 [u'Package: foo-bin',194 ['Package: foo-bin',
193 u'Source: foo',195 'Source: foo',
194 u'Priority: standard',196 'Priority: standard',
195 u'Section: base',197 'Section: base',
196 u'Installed-Size: 100',198 'Installed-Size: 100',
197 u'Maintainer: Foo Bar <foo@bar.com>',199 'Maintainer: Foo Bar <foo@bar.com>',
198 u'Architecture: all',200 'Architecture: all',
199 u'Version: 666',201 'Version: 666',
200 u'Recommends: foo-dev',202 'Recommends: foo-dev',
201 u'Replaces: old-foo',203 'Replaces: old-foo',
202 u'Suggests: pyfoo',204 'Suggests: pyfoo',
203 u'Provides: foo-master',205 'Provides: foo-master',
204 u'Depends: biscuit',206 'Depends: biscuit',
205 u'Conflicts: old-foo',207 'Conflicts: old-foo',
206 u'Pre-Depends: master-foo',208 'Pre-Depends: master-foo',
207 u'Enhances: foo-super',209 'Enhances: foo-super',
208 u'Breaks: old-foo',210 'Breaks: old-foo',
209 u'Filename: pool/main/f/foo/foo-bin_666_all.deb',211 'Filename: pool/main/f/foo/foo-bin_666_all.deb',
210 u'Size: 18',212 'Size: 18',
211 u'MD5sum: ' + self.deb_md5,213 'MD5sum: ' + self.deb_md5,
212 u'SHA1: ' + self.deb_sha1,214 'SHA1: ' + self.deb_sha1,
213 u'SHA256: ' + self.deb_sha256,215 'SHA256: ' + self.deb_sha256,
214 u'Description: Foo app is great',216 'Description: Foo app is great',
215 u' Well ...',217 ' Well ...',
216 u' it does nothing, though',218 ' it does nothing, though',
217 u'Python-Version: >= 2.4'],219 'Python-Version: >= 2.4'],
218 build_bpph_stanza(pub_binary).makeOutput().splitlines())220 build_bpph_stanza(pub_binary).makeOutput().splitlines())
219221
220 def testBinaryStanzaDescription(self):222 def testBinaryStanzaDescription(self):
@@ -245,26 +247,26 @@
245 description=description)[0]247 description=description)[0]
246248
247 self.assertEqual(249 self.assertEqual(
248 [u'Package: foo-bin',250 ['Package: foo-bin',
249 u'Source: foo',251 'Source: foo',
250 u'Priority: standard',252 'Priority: standard',
251 u'Section: base',253 'Section: base',
252 u'Installed-Size: 100',254 'Installed-Size: 100',
253 u'Maintainer: Foo Bar <foo@bar.com>',255 'Maintainer: Foo Bar <foo@bar.com>',
254 u'Architecture: all',256 'Architecture: all',
255 u'Version: 666',257 'Version: 666',
256 u'Filename: pool/main/f/foo/foo-bin_666_all.deb',258 'Filename: pool/main/f/foo/foo-bin_666_all.deb',
257 u'Size: 18',259 'Size: 18',
258 u'MD5sum: ' + self.deb_md5,260 'MD5sum: ' + self.deb_md5,
259 u'SHA1: ' + self.deb_sha1,261 'SHA1: ' + self.deb_sha1,
260 u'SHA256: ' + self.deb_sha256,262 'SHA256: ' + self.deb_sha256,
261 u'Description: Foo app is great',263 'Description: Foo app is great',
262 u' Normal',264 ' Normal',
263 u' Normal',265 ' Normal',
264 u' .',266 ' .',
265 u' .',267 ' .',
266 u' .',268 ' .',
267 u' %s' % ('x' * 100),269 ' %s' % ('x' * 100),
268 ],270 ],
269 build_bpph_stanza(pub_binary).makeOutput().splitlines())271 build_bpph_stanza(pub_binary).makeOutput().splitlines())
270272
@@ -277,26 +279,26 @@
277 The encoding should be preserved and able to be encoded in279 The encoding should be preserved and able to be encoded in
278 'utf-8' for disk writing.280 'utf-8' for disk writing.
279 """281 """
280 description = u'Using non-ascii as: \xe7\xe3\xe9\xf3'282 description = 'Using non-ascii as: \xe7\xe3\xe9\xf3'
281 pub_binary = self.getPubBinaries(283 pub_binary = self.getPubBinaries(
282 description=description)[0]284 description=description)[0]
283285
284 self.assertEqual(286 self.assertEqual(
285 [u'Package: foo-bin',287 ['Package: foo-bin',
286 u'Source: foo',288 'Source: foo',
287 u'Priority: standard',289 'Priority: standard',
288 u'Section: base',290 'Section: base',
289 u'Installed-Size: 100',291 'Installed-Size: 100',
290 u'Maintainer: Foo Bar <foo@bar.com>',292 'Maintainer: Foo Bar <foo@bar.com>',
291 u'Architecture: all',293 'Architecture: all',
292 u'Version: 666',294 'Version: 666',
293 u'Filename: pool/main/f/foo/foo-bin_666_all.deb',295 'Filename: pool/main/f/foo/foo-bin_666_all.deb',
294 u'Size: 18',296 'Size: 18',
295 u'MD5sum: ' + self.deb_md5,297 'MD5sum: ' + self.deb_md5,
296 u'SHA1: ' + self.deb_sha1,298 'SHA1: ' + self.deb_sha1,
297 u'SHA256: ' + self.deb_sha256,299 'SHA256: ' + self.deb_sha256,
298 u'Description: Foo app is great',300 'Description: Foo app is great',
299 u' Using non-ascii as: \xe7\xe3\xe9\xf3',301 ' Using non-ascii as: \xe7\xe3\xe9\xf3',
300 ],302 ],
301 build_bpph_stanza(pub_binary).makeOutput().splitlines())303 build_bpph_stanza(pub_binary).makeOutput().splitlines())
302304
@@ -315,7 +317,7 @@
315 pub_binary = self.getPubBinaries(317 pub_binary = self.getPubBinaries(
316 binaryname='foo-bin', pub_source=pub_source)[0]318 binaryname='foo-bin', pub_source=pub_source)[0]
317 self.assertEqual(319 self.assertEqual(
318 u'foo',320 'foo',
319 get_field(build_bpph_stanza(pub_binary), 'Source'))321 get_field(build_bpph_stanza(pub_binary), 'Source'))
320322
321 def testBinaryIncludesDifferingSourceVersion(self):323 def testBinaryIncludesDifferingSourceVersion(self):
@@ -324,7 +326,7 @@
324 pub_binary = self.getPubBinaries(326 pub_binary = self.getPubBinaries(
325 binaryname='foo', version='999', pub_source=pub_source)[0]327 binaryname='foo', version='999', pub_source=pub_source)[0]
326 self.assertEqual(328 self.assertEqual(
327 u'foo (666)',329 'foo (666)',
328 get_field(build_bpph_stanza(pub_binary), 'Source'))330 get_field(build_bpph_stanza(pub_binary), 'Source'))
329331
330332
331333
=== modified file 'lib/lp/archivepublisher/tests/test_pool.py'
--- lib/lp/archivepublisher/tests/test_pool.py 2010-12-20 07:52:32 +0000
+++ lib/lp/archivepublisher/tests/test_pool.py 2018-02-02 11:57:41 +0000
@@ -1,8 +1,10 @@
1# Copyright 2009-2010 Canonical Ltd. This software is licensed under the1# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Tests for pool.py."""4"""Tests for pool.py."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8import hashlib10import hashlib
911
=== modified file 'lib/lp/archivepublisher/tests/test_processaccepted.py'
--- lib/lp/archivepublisher/tests/test_processaccepted.py 2014-08-09 19:45:00 +0000
+++ lib/lp/archivepublisher/tests/test_processaccepted.py 2018-02-02 11:57:41 +0000
@@ -1,8 +1,10 @@
1# Copyright 2010-2014 Canonical Ltd. This software is licensed under the1# Copyright 2010-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Test process-accepted.py"""4"""Test process-accepted.py"""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6from optparse import OptionValueError8from optparse import OptionValueError
79
8from testtools.matchers import LessThan10from testtools.matchers import LessThan
@@ -35,7 +37,7 @@
35 TestCaseWithFactory.setUp(self)37 TestCaseWithFactory.setUp(self)
36 self.stp = SoyuzTestPublisher()38 self.stp = SoyuzTestPublisher()
37 self.stp.prepareBreezyAutotest()39 self.stp.prepareBreezyAutotest()
38 self.test_package_name = u"accept-test"40 self.test_package_name = "accept-test"
39 self.distro = self.factory.makeDistribution()41 self.distro = self.factory.makeDistribution()
4042
41 def getScript(self, test_args=None):43 def getScript(self, test_args=None):
4244
=== modified file 'lib/lp/archivepublisher/tests/test_processdeathrow.py'
--- lib/lp/archivepublisher/tests/test_processdeathrow.py 2014-08-09 19:45:00 +0000
+++ lib/lp/archivepublisher/tests/test_processdeathrow.py 2018-02-02 11:57:41 +0000
@@ -1,4 +1,4 @@
1# Copyright 2009-2010 Canonical Ltd. This software is licensed under the1# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Functional tests for process-death-row.py script.4"""Functional tests for process-death-row.py script.
@@ -8,6 +8,8 @@
8processes its arguments and handles dry-run correctly.8processes its arguments and handles dry-run correctly.
9"""9"""
1010
11from __future__ import absolute_import, print_function, unicode_literals
12
11__metaclass__ = type13__metaclass__ = type
1214
13import datetime15import datetime
@@ -105,12 +107,12 @@
105107
106 cprov = getUtility(IPersonSet).getByName('cprov')108 cprov = getUtility(IPersonSet).getByName('cprov')
107 removeSecurityProxy(cprov.archive).distribution = ubuntutest109 removeSecurityProxy(cprov.archive).distribution = ubuntutest
108 ppa_pubrecs = cprov.archive.getPublishedSources(u'iceweasel')110 ppa_pubrecs = cprov.archive.getPublishedSources('iceweasel')
109 self.ppa_pubrec_ids = self.markPublishingForRemoval(ppa_pubrecs)111 self.ppa_pubrec_ids = self.markPublishingForRemoval(ppa_pubrecs)
110112
111 mark = getUtility(IPersonSet).getByName('mark')113 mark = getUtility(IPersonSet).getByName('mark')
112 removeSecurityProxy(mark.archive).distribution = ubuntutest114 removeSecurityProxy(mark.archive).distribution = ubuntutest
113 ppa_pubrecs = mark.archive.getPublishedSources(u'iceweasel')115 ppa_pubrecs = mark.archive.getPublishedSources('iceweasel')
114 self.ppa_pubrec_ids.extend(self.markPublishingForRemoval(ppa_pubrecs))116 self.ppa_pubrec_ids.extend(self.markPublishingForRemoval(ppa_pubrecs))
115117
116 # Fill one of the files in cprov PPA just to ensure that deathrow118 # Fill one of the files in cprov PPA just to ensure that deathrow
117119
=== modified file 'lib/lp/archivepublisher/tests/test_publish_ftpmaster.py'
--- lib/lp/archivepublisher/tests/test_publish_ftpmaster.py 2016-12-05 22:16:25 +0000
+++ lib/lp/archivepublisher/tests/test_publish_ftpmaster.py 2018-02-02 11:57:41 +0000
@@ -1,8 +1,10 @@
1# Copyright 2011-2016 Canonical Ltd. This software is licensed under the1# Copyright 2011-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Test publish-ftpmaster cron script."""4"""Test publish-ftpmaster cron script."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8import logging10import logging
@@ -1306,7 +1308,7 @@
1306 have_fresh_series = script.prepareFreshSeries(distro)1308 have_fresh_series = script.prepareFreshSeries(distro)
1307 self.assertTrue(have_fresh_series)1309 self.assertTrue(have_fresh_series)
1308 [copied_upload] = new_series.getPackageUploads(1310 [copied_upload] = new_series.getPackageUploads(
1309 name=u'debian-installer-images', exact_match=False)1311 name='debian-installer-images', exact_match=False)
1310 [copied_custom] = copied_upload.customfiles1312 [copied_custom] = copied_upload.customfiles
1311 self.assertEqual(1313 self.assertEqual(
1312 custom_upload.customfiles[0].libraryfilealias.filename,1314 custom_upload.customfiles[0].libraryfilealias.filename,
13131315
=== modified file 'lib/lp/archivepublisher/tests/test_publishdistro.py'
--- lib/lp/archivepublisher/tests/test_publishdistro.py 2017-04-29 15:24:32 +0000
+++ lib/lp/archivepublisher/tests/test_publishdistro.py 2018-02-02 11:57:41 +0000
@@ -1,8 +1,10 @@
1# Copyright 2009-2017 Canonical Ltd. This software is licensed under the1# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Functional tests for publish-distro.py script."""4"""Functional tests for publish-distro.py script."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8from optparse import OptionValueError10from optparse import OptionValueError
911
=== modified file 'lib/lp/archivepublisher/tests/test_publisher.py'
--- lib/lp/archivepublisher/tests/test_publisher.py 2017-04-29 15:24:32 +0000
+++ lib/lp/archivepublisher/tests/test_publisher.py 2018-02-02 11:57:41 +0000
@@ -1,8 +1,10 @@
1# Copyright 2009-2017 Canonical Ltd. This software is licensed under the1# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Tests for publisher class."""4"""Tests for publisher class."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8import bz210import bz2
@@ -450,7 +452,7 @@
450 for pu_build in pu_i386.builds:452 for pu_build in pu_i386.builds:
451 pu_build.publish()453 pu_build.publish()
452454
453 publications = archive.getAllPublishedBinaries(name=u"bin-i386")455 publications = archive.getAllPublishedBinaries(name="bin-i386")
454456
455 self.assertEqual(1, publications.count())457 self.assertEqual(1, publications.count())
456 self.assertEqual(458 self.assertEqual(
@@ -809,14 +811,14 @@
809 self.assertFalse(os.path.exists(publisher._config.metaroot))811 self.assertFalse(os.path.exists(publisher._config.metaroot))
810 self.assertEqual(ArchiveStatus.DELETED, test_archive.status)812 self.assertEqual(ArchiveStatus.DELETED, test_archive.status)
811 self.assertEqual(False, test_archive.publish)813 self.assertEqual(False, test_archive.publish)
812 self.assertEqual(u'testing-deletedppa', test_archive.name)814 self.assertEqual('testing-deletedppa', test_archive.name)
813815
814 # All of the archive's active publications have been marked816 # All of the archive's active publications have been marked
815 # DELETED, and dateremoved has been set early because they've817 # DELETED, and dateremoved has been set early because they've
816 # already been removed from disk.818 # already been removed from disk.
817 for pub in (spph, bpph, orphaned_bpph):819 for pub in (spph, bpph, orphaned_bpph):
818 self.assertEqual(PackagePublishingStatus.DELETED, pub.status)820 self.assertEqual(PackagePublishingStatus.DELETED, pub.status)
819 self.assertEqual(u'janitor', pub.removed_by.name)821 self.assertEqual('janitor', pub.removed_by.name)
820 self.assertIsNot(None, pub.dateremoved)822 self.assertIsNot(None, pub.dateremoved)
821823
822 # The SUPERSEDED publications now have dateremoved set, even824 # The SUPERSEDED publications now have dateremoved set, even
@@ -1252,7 +1254,7 @@
1252 self.assertEqual(1254 self.assertEqual(
1253 cprov.archive, archive_publisher.archive)1255 cprov.archive, archive_publisher.archive)
1254 self.assertEqual(1256 self.assertEqual(
1255 u'/var/tmp/ppa.test/cprov/ppa/ubuntutest/dists',1257 '/var/tmp/ppa.test/cprov/ppa/ubuntutest/dists',
1256 archive_publisher._config.distsroot)1258 archive_publisher._config.distsroot)
1257 self.assertEqual(1259 self.assertEqual(
1258 [('breezy-autotest', PackagePublishingPocket.RELEASE)],1260 [('breezy-autotest', PackagePublishingPocket.RELEASE)],
@@ -1933,7 +1935,7 @@
1933 """1935 """
1934 allowed_suites = []1936 allowed_suites = []
1935 cprov = getUtility(IPersonSet).getByName('cprov')1937 cprov = getUtility(IPersonSet).getByName('cprov')
1936 cprov.archive.displayname = u'PPA for Celso Provid\xe8lo'1938 cprov.archive.displayname = 'PPA for Celso Provid\xe8lo'
1937 archive_publisher = getPublisher(1939 archive_publisher = getPublisher(
1938 cprov.archive, allowed_suites, self.logger)1940 cprov.archive, allowed_suites, self.logger)
19391941
@@ -1950,7 +1952,7 @@
1950 self.assertEqual('LP-PPA-cprov', release['origin'])1952 self.assertEqual('LP-PPA-cprov', release['origin'])
19511953
1952 # The Label: field should be set to the archive displayname1954 # The Label: field should be set to the archive displayname
1953 self.assertEqual(u'PPA for Celso Provid\xe8lo', release['label'])1955 self.assertEqual('PPA for Celso Provid\xe8lo', release['label'])
19541956
1955 arch_sources_path = os.path.join(1957 arch_sources_path = os.path.join(
1956 archive_publisher._config.distsroot, 'breezy-autotest',1958 archive_publisher._config.distsroot, 'breezy-autotest',
@@ -2720,7 +2722,7 @@
2720 # A no-op run leaves the scheduled deletion date intact.2722 # A no-op run leaves the scheduled deletion date intact.
2721 i386_file = getUtility(IArchiveFileSet).getByArchive(2723 i386_file = getUtility(IArchiveFileSet).getByArchive(
2722 self.ubuntutest.main_archive,2724 self.ubuntutest.main_archive,
2723 path=u'dists/breezy-autotest/Contents-i386').one()2725 path='dists/breezy-autotest/Contents-i386').one()
2724 i386_date = i386_file.scheduled_deletion_date2726 i386_date = i386_file.scheduled_deletion_date
2725 self.runSteps(publisher, step_d=True)2727 self.runSteps(publisher, step_d=True)
2726 flush_database_caches()2728 flush_database_caches()
@@ -2746,7 +2748,7 @@
2746 # Arrange for the second file to be pruned.2748 # Arrange for the second file to be pruned.
2747 hppa_file = getUtility(IArchiveFileSet).getByArchive(2749 hppa_file = getUtility(IArchiveFileSet).getByArchive(
2748 self.ubuntutest.main_archive,2750 self.ubuntutest.main_archive,
2749 path=u'dists/breezy-autotest/Contents-hppa').one()2751 path='dists/breezy-autotest/Contents-hppa').one()
2750 removeSecurityProxy(hppa_file).scheduled_deletion_date = (2752 removeSecurityProxy(hppa_file).scheduled_deletion_date = (
2751 now - timedelta(hours=1))2753 now - timedelta(hours=1))
2752 self.runSteps(publisher, step_d=True)2754 self.runSteps(publisher, step_d=True)
@@ -2809,7 +2811,7 @@
2809 ByHashHasContents(main_contents))2811 ByHashHasContents(main_contents))
2810 archive_files = getUtility(IArchiveFileSet).getByArchive(2812 archive_files = getUtility(IArchiveFileSet).getByArchive(
2811 self.ubuntutest.main_archive,2813 self.ubuntutest.main_archive,
2812 path=u'dists/breezy-autotest/main/source/Sources')2814 path='dists/breezy-autotest/main/source/Sources')
2813 self.assertThat(2815 self.assertThat(
2814 sorted(archive_files, key=attrgetter('id')),2816 sorted(archive_files, key=attrgetter('id')),
2815 MatchesListwise([2817 MatchesListwise([
28162818
=== modified file 'lib/lp/archivepublisher/tests/test_publisher_documentation.py'
--- lib/lp/archivepublisher/tests/test_publisher_documentation.py 2012-01-20 15:42:44 +0000
+++ lib/lp/archivepublisher/tests/test_publisher_documentation.py 2018-02-02 11:57:41 +0000
@@ -1,8 +1,10 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the1# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Runs the archivepublisher doctests."""4"""Runs the archivepublisher doctests."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8import logging10import logging
911
=== modified file 'lib/lp/archivepublisher/tests/test_publisherconfig.py'
--- lib/lp/archivepublisher/tests/test_publisherconfig.py 2013-06-20 05:50:00 +0000
+++ lib/lp/archivepublisher/tests/test_publisherconfig.py 2018-02-02 11:57:41 +0000
@@ -1,8 +1,10 @@
1# Copyright 2011 Canonical Ltd. This software is licensed under the1# Copyright 2011-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Tests for publisherConfig model class."""4"""Tests for publisherConfig model class."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
810
@@ -45,9 +47,9 @@
4547
46 def test_properties(self):48 def test_properties(self):
47 # Test the model properties.49 # Test the model properties.
48 ROOT_DIR = u"rootdir/test"50 ROOT_DIR = "rootdir/test"
49 BASE_URL = u"http://base.url"51 BASE_URL = "http://base.url"
50 COPY_BASE_URL = u"http://base.url"52 COPY_BASE_URL = "http://base.url"
51 pubconf = self.factory.makePublisherConfig(53 pubconf = self.factory.makePublisherConfig(
52 distribution=self.distribution,54 distribution=self.distribution,
53 root_dir=ROOT_DIR,55 root_dir=ROOT_DIR,
@@ -83,7 +85,7 @@
8385
84 def test_only_admin(self):86 def test_only_admin(self):
85 # Only admins can see and change the config.87 # Only admins can see and change the config.
86 distro = self.factory.makeDistribution(publish_root_dir=u"foo")88 distro = self.factory.makeDistribution(publish_root_dir="foo")
87 config = getUtility(IPublisherConfigSet).getByDistribution(distro)89 config = getUtility(IPublisherConfigSet).getByDistribution(distro)
8890
89 login(ANONYMOUS)91 login(ANONYMOUS)
@@ -91,6 +93,6 @@
91 self.assertRaises(Unauthorized, setattr, config, "root_dir", "test")93 self.assertRaises(Unauthorized, setattr, config, "root_dir", "test")
9294
93 login(LAUNCHPAD_ADMIN)95 login(LAUNCHPAD_ADMIN)
94 self.assertEqual(u"foo", config.root_dir)96 self.assertEqual("foo", config.root_dir)
95 config.root_dir = u"bar"97 config.root_dir = "bar"
96 self.assertEqual(u"bar", config.root_dir)98 self.assertEqual("bar", config.root_dir)
9799
=== modified file 'lib/lp/archivepublisher/tests/test_repositoryindexfile.py'
--- lib/lp/archivepublisher/tests/test_repositoryindexfile.py 2016-10-04 01:27:20 +0000
+++ lib/lp/archivepublisher/tests/test_repositoryindexfile.py 2018-02-02 11:57:41 +0000
@@ -1,8 +1,10 @@
1# Copyright 2009-2016 Canonical Ltd. This software is licensed under the1# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Tests for `RepositoryIndexFile`."""4"""Tests for `RepositoryIndexFile`."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8import bz210import bz2
911
=== modified file 'lib/lp/archivepublisher/tests/test_rosetta_translations.py'
--- lib/lp/archivepublisher/tests/test_rosetta_translations.py 2016-05-23 10:14:39 +0000
+++ lib/lp/archivepublisher/tests/test_rosetta_translations.py 2018-02-02 11:57:41 +0000
@@ -1,4 +1,4 @@
1# Copyright 2013-2016 Canonical Ltd. This software is licensed under the1# Copyright 2013-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Test rosetta-translations custom uploads.4"""Test rosetta-translations custom uploads.
@@ -7,6 +7,8 @@
7high-level tests of rosetta-translations upload and queue manipulation.7high-level tests of rosetta-translations upload and queue manipulation.
8"""8"""
99
10from __future__ import absolute_import, print_function, unicode_literals
11
10from storm.expr import Desc12from storm.expr import Desc
11import transaction13import transaction
12from zope.component import getUtility14from zope.component import getUtility
@@ -50,8 +52,8 @@
50 """Create an LibraryFileAlias containing dummy translation data."""52 """Create an LibraryFileAlias containing dummy translation data."""
51 if tar_content is None:53 if tar_content is None:
52 tar_content = {54 tar_content = {
53 'source/po/foo.pot': 'Foo template',55 'source/po/foo.pot': b'Foo template',
54 'source/po/eo.po': 'Foo translation',56 'source/po/eo.po': b'Foo translation',
55 }57 }
56 tarfile_content = LaunchpadWriteTarFile.files_to_string(58 tarfile_content = LaunchpadWriteTarFile.files_to_string(
57 tar_content)59 tar_content)
5860
=== modified file 'lib/lp/archivepublisher/tests/test_signing.py'
--- lib/lp/archivepublisher/tests/test_signing.py 2017-08-02 19:13:48 +0000
+++ lib/lp/archivepublisher/tests/test_signing.py 2018-02-02 11:57:41 +0000
@@ -1,8 +1,10 @@
1# Copyright 2012-2017 Canonical Ltd. This software is licensed under the1# Copyright 2012-2018 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Test UEFI custom uploads."""4"""Test UEFI custom uploads."""
55
6from __future__ import absolute_import, print_function, unicode_literals
7
6__metaclass__ = type8__metaclass__ = type
79
8import os10import os
@@ -255,9 +257,9 @@
255 if not os.path.exists(pubconf.temproot):257 if not os.path.exists(pubconf.temproot):
256 os.makedirs(pubconf.temproot)258 os.makedirs(pubconf.temproot)
257 self.openArchive("test", "1.0", "amd64")259 self.openArchive("test", "1.0", "amd64")
258 self.tarfile.add_file("1.0/empty.efi", "")260 self.tarfile.add_file("1.0/empty.efi", b"")
259 self.tarfile.add_file("1.0/empty.ko", "")261 self.tarfile.add_file("1.0/empty.ko", b"")
260 self.tarfile.add_file("1.0/empty.opal", "")262 self.tarfile.add_file("1.0/empty.opal", b"")
261 upload = self.process_emulate()263 upload = self.process_emulate()
262 self.assertContentEqual([], upload.callLog.caller_list())264 self.assertContentEqual([], upload.callLog.caller_list())
263265
@@ -265,9 +267,9 @@
265 # If the configured key/cert are missing, processing succeeds but267 # If the configured key/cert are missing, processing succeeds but
266 # nothing is signed.268 # nothing is signed.
267 self.openArchive("test", "1.0", "amd64")269 self.openArchive("test", "1.0", "amd64")
268 self.tarfile.add_file("1.0/empty.efi", "")270 self.tarfile.add_file("1.0/empty.efi", b"")
269 self.tarfile.add_file("1.0/empty.ko", "")271 self.tarfile.add_file("1.0/empty.ko", b"")
270 self.tarfile.add_file("1.0/empty.opal", "")272 self.tarfile.add_file("1.0/empty.opal", b"")
271 upload = self.process_emulate()273 upload = self.process_emulate()
272 self.assertContentEqual([], upload.callLog.caller_list())274 self.assertContentEqual([], upload.callLog.caller_list())
273275
@@ -277,9 +279,9 @@
277 self.setUpUefiKeys()279 self.setUpUefiKeys()
278 self.setUpKmodKeys()280 self.setUpKmodKeys()
279 self.openArchive("test", "1.0", "amd64")281 self.openArchive("test", "1.0", "amd64")
280 self.tarfile.add_file("1.0/empty.efi", "")282 self.tarfile.add_file("1.0/empty.efi", b"")
281 self.tarfile.add_file("1.0/empty.ko", "")283 self.tarfile.add_file("1.0/empty.ko", b"")
282 self.tarfile.add_file("1.0/empty.opal", "")284 self.tarfile.add_file("1.0/empty.opal", b"")
283 upload = self.process_emulate()285 upload = self.process_emulate()
284 expected_callers = [286 expected_callers = [
285 ('UEFI signing', 1),287 ('UEFI signing', 1),
@@ -292,9 +294,9 @@
292 # nothing is signed.294 # nothing is signed.
293 self.setUpPPA()295 self.setUpPPA()
294 self.openArchive("test", "1.0", "amd64")296 self.openArchive("test", "1.0", "amd64")
295 self.tarfile.add_file("1.0/empty.efi", "")297 self.tarfile.add_file("1.0/empty.efi", b"")
296 self.tarfile.add_file("1.0/empty.ko", "")298 self.tarfile.add_file("1.0/empty.ko", b"")
297 self.tarfile.add_file("1.0/empty.opal", "")299 self.tarfile.add_file("1.0/empty.opal", b"")
298 upload = self.process_emulate()300 upload = self.process_emulate()
299 expected_callers = [301 expected_callers = [
300 ('UEFI keygen', 1),302 ('UEFI keygen', 1),
@@ -352,7 +354,7 @@
352 # If the configured key/cert are missing, processing succeeds but354 # If the configured key/cert are missing, processing succeeds but
353 # nothing is signed.355 # nothing is signed.
354 self.openArchive("test", "1.0", "amd64")356 self.openArchive("test", "1.0", "amd64")
355 self.tarfile.add_file("1.0/control/options", "")357 self.tarfile.add_file("1.0/control/options", b"")
356 upload = self.process_emulate()358 upload = self.process_emulate()
357 self.assertContentEqual([], upload.signing_options.keys())359 self.assertContentEqual([], upload.signing_options.keys())
358360
@@ -360,7 +362,7 @@
360 # If the configured key/cert are missing, processing succeeds but362 # If the configured key/cert are missing, processing succeeds but
361 # nothing is signed.363 # nothing is signed.
362 self.openArchive("test", "1.0", "amd64")364 self.openArchive("test", "1.0", "amd64")
363 self.tarfile.add_file("1.0/control/options", "first\n")365 self.tarfile.add_file("1.0/control/options", b"first\n")
364 upload = self.process_emulate()366 upload = self.process_emulate()
365 self.assertContentEqual(['first'], upload.signing_options.keys())367 self.assertContentEqual(['first'], upload.signing_options.keys())
366368
@@ -368,7 +370,7 @@
368 # If the configured key/cert are missing, processing succeeds but370 # If the configured key/cert are missing, processing succeeds but
369 # nothing is signed.371 # nothing is signed.
370 self.openArchive("test", "1.0", "amd64")372 self.openArchive("test", "1.0", "amd64")
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")
372 upload = self.process_emulate()374 upload = self.process_emulate()
373 self.assertContentEqual(['first', 'second'],375 self.assertContentEqual(['first', 'second'],
374 upload.signing_options.keys())376 upload.signing_options.keys())
@@ -379,9 +381,9 @@
379 self.setUpKmodKeys()381 self.setUpKmodKeys()
380 self.setUpOpalKeys()382 self.setUpOpalKeys()
381 self.openArchive("test", "1.0", "amd64")383 self.openArchive("test", "1.0", "amd64")
382 self.tarfile.add_file("1.0/empty.efi", "")384 self.tarfile.add_file("1.0/empty.efi", b"")
383 self.tarfile.add_file("1.0/empty.ko", "")385 self.tarfile.add_file("1.0/empty.ko", b"")
384 self.tarfile.add_file("1.0/empty.opal", "")386 self.tarfile.add_file("1.0/empty.opal", b"")
385 self.process_emulate()387 self.process_emulate()
386 self.assertThat(self.getSignedPath("test", "amd64"), SignedMatches([388 self.assertThat(self.getSignedPath("test", "amd64"), SignedMatches([
387 "1.0/SHA256SUMS",389 "1.0/SHA256SUMS",
@@ -397,10 +399,10 @@
397 self.setUpKmodKeys()399 self.setUpKmodKeys()
398 self.setUpOpalKeys()400 self.setUpOpalKeys()
399 self.openArchive("test", "1.0", "amd64")401 self.openArchive("test", "1.0", "amd64")
400 self.tarfile.add_file("1.0/control/options", "tarball")402 self.tarfile.add_file("1.0/control/options", b"tarball")
401 self.tarfile.add_file("1.0/empty.efi", "")403 self.tarfile.add_file("1.0/empty.efi", b"")
402 self.tarfile.add_file("1.0/empty.ko", "")404 self.tarfile.add_file("1.0/empty.ko", b"")
403 self.tarfile.add_file("1.0/empty.opal", "")405 self.tarfile.add_file("1.0/empty.opal", b"")
404 self.process_emulate()406 self.process_emulate()
405 self.assertThat(self.getSignedPath("test", "amd64"), SignedMatches([407 self.assertThat(self.getSignedPath("test", "amd64"), SignedMatches([
406 "1.0/SHA256SUMS",408 "1.0/SHA256SUMS",
@@ -425,10 +427,10 @@
425 self.setUpKmodKeys()427 self.setUpKmodKeys()
426 self.setUpOpalKeys()428 self.setUpOpalKeys()
427 self.openArchive("test", "1.0", "amd64")429 self.openArchive("test", "1.0", "amd64")
428 self.tarfile.add_file("1.0/control/options", "signed-only")430 self.tarfile.add_file("1.0/control/options", b"signed-only")
429 self.tarfile.add_file("1.0/empty.efi", "")431 self.tarfile.add_file("1.0/empty.efi", b"")
430 self.tarfile.add_file("1.0/empty.ko", "")432 self.tarfile.add_file("1.0/empty.ko", b"")
431 self.tarfile.add_file("1.0/empty.opal", "")433 self.tarfile.add_file("1.0/empty.opal", b"")
432 self.process_emulate()434 self.process_emulate()
433 self.assertThat(self.getSignedPath("test", "amd64"), SignedMatches([435 self.assertThat(self.getSignedPath("test", "amd64"), SignedMatches([
434 "1.0/SHA256SUMS", "1.0/control/options",436 "1.0/SHA256SUMS", "1.0/control/options",
@@ -445,11 +447,10 @@
445 self.setUpKmodKeys()447 self.setUpKmodKeys()
446 self.setUpOpalKeys()448 self.setUpOpalKeys()
447 self.openArchive("test", "1.0", "amd64")449 self.openArchive("test", "1.0", "amd64")
448 self.tarfile.add_file("1.0/control/options",450 self.tarfile.add_file("1.0/control/options", b"tarball\nsigned-only")
449 "tarball\nsigned-only")451 self.tarfile.add_file("1.0/empty.efi", b"")
450 self.tarfile.add_file("1.0/empty.efi", "")452 self.tarfile.add_file("1.0/empty.ko", b"")
451 self.tarfile.add_file("1.0/empty.ko", "")453 self.tarfile.add_file("1.0/empty.opal", b"")
452 self.tarfile.add_file("1.0/empty.opal", "")
453 self.process_emulate()454 self.process_emulate()
454 self.assertThat(self.getSignedPath("test", "amd64"), SignedMatches([455 self.assertThat(self.getSignedPath("test", "amd64"), SignedMatches([
455 "1.0/SHA256SUMS",456 "1.0/SHA256SUMS",
@@ -470,7 +471,7 @@
470 # Nothing is signed.471 # Nothing is signed.
471 self.setUpUefiKeys()472 self.setUpUefiKeys()
472 self.openArchive("empty", "1.0", "amd64")473 self.openArchive("empty", "1.0", "amd64")
473 self.tarfile.add_file("1.0/hello", "world")474 self.tarfile.add_file("1.0/hello", b"world")
474 upload = self.process()475 upload = self.process()
475 self.assertTrue(os.path.exists(os.path.join(476 self.assertTrue(os.path.exists(os.path.join(
476 self.getSignedPath("empty", "amd64"), "1.0", "hello")))477 self.getSignedPath("empty", "amd64"), "1.0", "hello")))
@@ -481,7 +482,7 @@
481 # If the target directory already exists, processing fails.482 # If the target directory already exists, processing fails.
482 self.setUpUefiKeys()483 self.setUpUefiKeys()
483 self.openArchive("test", "1.0", "amd64")484 self.openArchive("test", "1.0", "amd64")
484 self.tarfile.add_file("1.0/empty.efi", "")485 self.tarfile.add_file("1.0/empty.efi", b"")
485 os.makedirs(os.path.join(self.getSignedPath("test", "amd64"), "1.0"))486 os.makedirs(os.path.join(self.getSignedPath("test", "amd64"), "1.0"))
486 self.assertRaises(CustomUploadAlreadyExists, self.process)487 self.assertRaises(CustomUploadAlreadyExists, self.process)
487488
@@ -489,7 +490,7 @@
489 # The umask must be 0o022 to avoid incorrect permissions.490 # The umask must be 0o022 to avoid incorrect permissions.
490 self.setUpUefiKeys()491 self.setUpUefiKeys()
491 self.openArchive("test", "1.0", "amd64")492 self.openArchive("test", "1.0", "amd64")
492 self.tarfile.add_file("1.0/dir/file.efi", "foo")493 self.tarfile.add_file("1.0/dir/file.efi", b"foo")
493 os.umask(0o002) # cleanup already handled by setUp494 os.umask(0o002) # cleanup already handled by setUp
494 self.assertRaises(CustomUploadBadUmask, self.process)495 self.assertRaises(CustomUploadBadUmask, self.process)
495496
@@ -684,7 +685,7 @@
684 # Each image in the tarball is signed.685 # Each image in the tarball is signed.
685 self.setUpUefiKeys()686 self.setUpUefiKeys()
686 self.openArchive("test", "1.0", "amd64")687 self.openArchive("test", "1.0", "amd64")
687 self.tarfile.add_file("1.0/empty.efi", "")688 self.tarfile.add_file("1.0/empty.efi", b"")
688 upload = self.process()689 upload = self.process()
689 self.assertEqual(1, upload.signUefi.call_count)690 self.assertEqual(1, upload.signUefi.call_count)
690691
@@ -692,7 +693,7 @@
692 # Each image in the tarball is signed.693 # Each image in the tarball is signed.
693 self.setUpKmodKeys()694 self.setUpKmodKeys()
694 self.openArchive("test", "1.0", "amd64")695 self.openArchive("test", "1.0", "amd64")
695 self.tarfile.add_file("1.0/empty.ko", "")696 self.tarfile.add_file("1.0/empty.ko", b"")
696 upload = self.process()697 upload = self.process()
697 self.assertEqual(1, upload.signKmod.call_count)698 self.assertEqual(1, upload.signKmod.call_count)
698699
@@ -700,7 +701,7 @@
700 # Each image in the tarball is signed.701 # Each image in the tarball is signed.
701 self.setUpOpalKeys()702 self.setUpOpalKeys()
702 self.openArchive("test", "1.0", "amd64")703 self.openArchive("test", "1.0", "amd64")
703 self.tarfile.add_file("1.0/empty.opal", "")704 self.tarfile.add_file("1.0/empty.opal", b"")
704 upload = self.process()705 upload = self.process()
705 self.assertEqual(1, upload.signOpal.call_count)706 self.assertEqual(1, upload.signOpal.call_count)
706707
@@ -708,12 +709,12 @@
708 # Each image in the tarball is signed.709 # Each image in the tarball is signed.
709 self.setUpKmodKeys()710 self.setUpKmodKeys()
710 self.openArchive("test", "1.0", "amd64")711 self.openArchive("test", "1.0", "amd64")
711 self.tarfile.add_file("1.0/empty.efi", "")712 self.tarfile.add_file("1.0/empty.efi", b"")
712 self.tarfile.add_file("1.0/empty.ko", "")713 self.tarfile.add_file("1.0/empty.ko", b"")
713 self.tarfile.add_file("1.0/empty2.ko", "")714 self.tarfile.add_file("1.0/empty2.ko", b"")
714 self.tarfile.add_file("1.0/empty.opal", "")715 self.tarfile.add_file("1.0/empty.opal", b"")
715 self.tarfile.add_file("1.0/empty2.opal", "")716 self.tarfile.add_file("1.0/empty2.opal", b"")
716 self.tarfile.add_file("1.0/empty3.opal", "")717 self.tarfile.add_file("1.0/empty3.opal", b"")
717 upload = self.process()718 upload = self.process()
718 self.assertEqual(1, upload.signUefi.call_count)719 self.assertEqual(1, upload.signUefi.call_count)
719 self.assertEqual(2, upload.signKmod.call_count)720 self.assertEqual(2, upload.signKmod.call_count)
@@ -723,7 +724,7 @@
723 # Files in the tarball are installed correctly.724 # Files in the tarball are installed correctly.
724 self.setUpUefiKeys()725 self.setUpUefiKeys()
725 self.openArchive("test", "1.0", "amd64")726 self.openArchive("test", "1.0", "amd64")
726 self.tarfile.add_file("1.0/empty.efi", "")727 self.tarfile.add_file("1.0/empty.efi", b"")
727 self.process()728 self.process()
728 self.assertTrue(os.path.isdir(os.path.join(729 self.assertTrue(os.path.isdir(os.path.join(
729 self.getDistsPath(), "signed")))730 self.getDistsPath(), "signed")))
@@ -735,7 +736,7 @@
735 os.makedirs(os.path.join(self.getDistsPath(), "uefi"))736 os.makedirs(os.path.join(self.getDistsPath(), "uefi"))
736 self.setUpUefiKeys()737 self.setUpUefiKeys()
737 self.openArchive("test", "1.0", "amd64")738 self.openArchive("test", "1.0", "amd64")
738 self.tarfile.add_file("1.0/empty.efi", "")739 self.tarfile.add_file("1.0/empty.efi", b"")
739 self.process()740 self.process()
740 self.assertTrue(os.path.isdir(os.path.join(741 self.assertTrue(os.path.isdir(os.path.join(
741 self.getDistsPath(), "signed")))742 self.getDistsPath(), "signed")))
@@ -747,7 +748,7 @@
747 os.makedirs(os.path.join(self.getDistsPath(), "signing"))748 os.makedirs(os.path.join(self.getDistsPath(), "signing"))
748 self.setUpUefiKeys()749 self.setUpUefiKeys()
749 self.openArchive("test", "1.0", "amd64")750 self.openArchive("test", "1.0", "amd64")
750 self.tarfile.add_file("1.0/empty.efi", "")751 self.tarfile.add_file("1.0/empty.efi", b"")
751 self.process()752 self.process()
752 self.assertTrue(os.path.isdir(os.path.join(753 self.assertTrue(os.path.isdir(os.path.join(
753 self.getDistsPath(), "signed")))754 self.getDistsPath(), "signed")))
@@ -870,9 +871,9 @@
870 self.setUpKmodKeys()871 self.setUpKmodKeys()
871 self.setUpOpalKeys()872 self.setUpOpalKeys()
872 self.openArchive("test", "1.0", "amd64")873 self.openArchive("test", "1.0", "amd64")
873 self.tarfile.add_file("1.0/empty.efi", "")874 self.tarfile.add_file("1.0/empty.efi", b"")
874 self.tarfile.add_file("1.0/empty.ko", "")875 self.tarfile.add_file("1.0/empty.ko", b"")
875 self.tarfile.add_file("1.0/empty.opal", "")876 self.tarfile.add_file("1.0/empty.opal", b"")
876 self.process_emulate()877 self.process_emulate()
877 sha256file = os.path.join(self.getSignedPath("test", "amd64"),878 sha256file = os.path.join(self.getSignedPath("test", "amd64"),
878 "1.0", "SHA256SUMS")879 "1.0", "SHA256SUMS")
@@ -888,9 +889,9 @@
888 self.setUpKmodKeys()889 self.setUpKmodKeys()
889 self.setUpOpalKeys()890 self.setUpOpalKeys()
890 self.openArchive("test", "1.0", "amd64")891 self.openArchive("test", "1.0", "amd64")
891 self.tarfile.add_file("1.0/empty.efi", "")892 self.tarfile.add_file("1.0/empty.efi", b"")
892 self.tarfile.add_file("1.0/empty.ko", "")893 self.tarfile.add_file("1.0/empty.ko", b"")
893 self.tarfile.add_file("1.0/empty.opal", "")894 self.tarfile.add_file("1.0/empty.opal", b"")
894 self.process_emulate()895 self.process_emulate()
895 sha256file = os.path.join(self.getSignedPath("test", "amd64"),896 sha256file = os.path.join(self.getSignedPath("test", "amd64"),
896 "1.0", "SHA256SUMS")897 "1.0", "SHA256SUMS")
@@ -907,10 +908,10 @@
907 self.setUpKmodKeys()908 self.setUpKmodKeys()
908 self.setUpOpalKeys()909 self.setUpOpalKeys()
909 self.openArchive("test", "1.0", "amd64")910 self.openArchive("test", "1.0", "amd64")
910 self.tarfile.add_file("1.0/control/options", "tarball")911 self.tarfile.add_file("1.0/control/options", b"tarball")
911 self.tarfile.add_file("1.0/empty.efi", "")912 self.tarfile.add_file("1.0/empty.efi", b"")
912 self.tarfile.add_file("1.0/empty.ko", "")913 self.tarfile.add_file("1.0/empty.ko", b"")
913 self.tarfile.add_file("1.0/empty.opal", "")914 self.tarfile.add_file("1.0/empty.opal", b"")
914 self.process_emulate()915 self.process_emulate()
915 sha256file = os.path.join(self.getSignedPath("test", "amd64"),916 sha256file = os.path.join(self.getSignedPath("test", "amd64"),
916 "1.0", "SHA256SUMS")917 "1.0", "SHA256SUMS")
@@ -951,7 +952,7 @@
951 # Files in the tarball are installed correctly.952 # Files in the tarball are installed correctly.
952 self.setUpUefiKeys()953 self.setUpUefiKeys()
953 self.openArchive("test", "1.0", "amd64")954 self.openArchive("test", "1.0", "amd64")
954 self.tarfile.add_file("1.0/empty.efi", "")955 self.tarfile.add_file("1.0/empty.efi", b"")
955 self.process()956 self.process()
956 self.assertTrue(os.path.isdir(os.path.join(957 self.assertTrue(os.path.isdir(os.path.join(
957 self.getDistsPath(), "uefi")))958 self.getDistsPath(), "uefi")))