11
11
>>> from lp.soyuz.model.publishing import (
12
12
... SourcePackagePublishingHistory)
13
13
>>> from lp.registry.interfaces.distribution import IDistributionSet
14
>>> from lp.registry.interfaces.distroseries import IDistroSeriesSet
14
>>> from lp.registry.interfaces.distroseries import (
15
18
>>> from lp.registry.interfaces.pocket import PackagePublishingPocket
16
19
>>> from lp.soyuz.interfaces.component import IComponentSet
17
20
>>> from lp.soyuz.enums import (
363
366
... def __init__(self, purpose):
364
367
... self.purpose = purpose
369
>>> class MockDistroSeries:
370
... implements(IDistroSeries)
371
... def __init__(self, version):
372
... self.version = version
366
374
>>> class MockSourcePackageRelease:
367
375
... implements(ISourcePackageRelease)
368
... def __init__(self, component, creator):
376
... def __init__(self, component, creator, upload_distroseries):
369
377
... self.component = getUtility(IComponentSet)[component]
378
... self.upload_distroseries = upload_distroseries
370
379
... self.creator = creator
371
380
... self.packageupload = 1
405
414
>>> release_pocket = PackagePublishingPocket.RELEASE
406
415
>>> archive = MockArchive(ArchivePurpose.PRIMARY)
408
>>> katie_sourcepackagerelease = MockSourcePackageRelease('main', katie)
417
>>> distro_series = MockDistroSeries(u'9.04')
418
>>> katie_sourcepackagerelease = MockSourcePackageRelease(
419
... 'main', katie, distro_series)
409
420
>>> sync_package_upload = MockPackageUpload(
410
421
... release_pocket, True, katie_sourcepackagerelease, archive)
411
422
>>> sync_package_upload.isAutoSyncUpload()
430
441
>>> person_set = getUtility(IPersonSet)
431
442
>>> carlos = person_set.getByName('carlos')
432
>>> carlos_sourcepackagerelease = MockSourcePackageRelease('main', carlos)
443
>>> carlos_sourcepackagerelease = MockSourcePackageRelease(
444
... 'main', carlos, distro_series)
433
445
>>> carlos_package_upload = MockPackageUpload(
434
446
... release_pocket, False, carlos_sourcepackagerelease, archive)
435
447
>>> carlos_package_upload.isAutoSyncUpload()
438
450
>>> translations_upload.publishRosettaTranslations()
439
451
Imported by: carlos
453
Uploads for distroseries before Oneiric or later may not be targeted
454
to any component but 'main' and 'restricted'. The upload attempt is ignored.
456
>>> katie_sourcepackagerelease = MockSourcePackageRelease(
457
... 'universe', katie, distro_series)
458
>>> sync_package_upload = MockPackageUpload(
459
... release_pocket, True, katie_sourcepackagerelease, archive)
460
>>> translations_upload = MockPackageUploadCustom()
461
>>> translations_upload.packageupload = sync_package_upload
462
>>> translations_upload.publishRosettaTranslations()
464
For Oneiric the import succeeds for 'universe'.
466
>>> distro_series = MockDistroSeries(u'11.10')
467
>>> katie_sourcepackagerelease = MockSourcePackageRelease(
468
... 'universe', katie, distro_series)
469
>>> sync_package_upload = MockPackageUpload(
470
... release_pocket, True, katie_sourcepackagerelease, archive)
471
>>> translations_upload = MockPackageUploadCustom()
472
>>> translations_upload.packageupload = sync_package_upload
473
>>> translations_upload.publishRosettaTranslations()
476
And for the 12.04 release the import succeeds for 'universe'.
478
>>> distro_series = MockDistroSeries(u'12.04')
479
>>> katie_sourcepackagerelease = MockSourcePackageRelease(
480
... 'universe', katie, distro_series)
481
>>> sync_package_upload = MockPackageUpload(
482
... release_pocket, True, katie_sourcepackagerelease, archive)
483
>>> translations_upload = MockPackageUploadCustom()
484
>>> translations_upload.packageupload = sync_package_upload
485
>>> translations_upload.publishRosettaTranslations()
442
490
Translations tarball
443
491
~~~~~~~~~~~~~~~~~~~~