56
56
from lp.soyuz.interfaces.archive import IArchiveSet
57
57
from lp.soyuz.tests.test_publishing import TestNativePublishingBase
58
58
from lp.testing import TestCaseWithFactory
59
from lp.testing.fakemethod import FakeMethod
59
60
from lp.testing.gpgkeys import gpgkeysdir
60
61
from lp.testing.keyserver import KeyServerTac
61
62
from lp.testing.layers import ZopelessDatabaseLayer
431
432
# remove locally created dir
432
433
shutil.rmtree(test_pool_dir)
435
def testPublishingSkipsObsoleteFuturePrimarySeries(self):
436
"""Publisher skips OBSOLETE/FUTURE series in PRIMARY archives."""
437
publisher = Publisher(
438
self.logger, self.config, self.disk_pool,
439
self.ubuntutest.main_archive)
440
# Remove security proxy so that the publisher can call our fake
442
publisher.distro = removeSecurityProxy(publisher.distro)
444
for status in (SeriesStatus.OBSOLETE, SeriesStatus.FUTURE):
445
naked_breezy_autotest = publisher.distro['breezy-autotest']
446
naked_breezy_autotest.status = status
447
naked_breezy_autotest.publish = FakeMethod(result=set())
449
publisher.A_publish(False)
451
self.assertEqual(0, naked_breezy_autotest.publish.call_count)
453
def testPublishingConsidersObsoleteFuturePPASeries(self):
454
"""Publisher does not skip OBSOLETE/FUTURE series in PPA archives."""
455
ubuntu_team = getUtility(IPersonSet).getByName('ubuntu-team')
456
test_archive = getUtility(IArchiveSet).new(
457
distribution=self.ubuntutest, owner=ubuntu_team,
458
purpose=ArchivePurpose.PPA)
459
publisher = Publisher(
460
self.logger, self.config, self.disk_pool, test_archive)
461
# Remove security proxy so that the publisher can call our fake
463
publisher.distro = removeSecurityProxy(publisher.distro)
465
for status in (SeriesStatus.OBSOLETE, SeriesStatus.FUTURE):
466
naked_breezy_autotest = publisher.distro['breezy-autotest']
467
naked_breezy_autotest.status = status
468
naked_breezy_autotest.publish = FakeMethod(result=set())
470
publisher.A_publish(False)
472
self.assertEqual(1, naked_breezy_autotest.publish.call_count)
434
474
def testPublisherBuilderFunctions(self):
435
475
"""Publisher can be initialized via provided helper function.