Merge lp:~stevenk/launchpad/archive-validate-stringfix into lp:launchpad

Proposed by Steve Kowalik on 2010-12-13
Status: Merged
Approved by: Julian Edwards on 2010-12-13
Approved revision: no longer in the source branch.
Merged at revision: 12045
Proposed branch: lp:~stevenk/launchpad/archive-validate-stringfix
Merge into: lp:launchpad
Diff against target: 42 lines (+13/-1)
2 files modified
lib/lp/soyuz/model/archive.py (+5/-1)
lib/lp/soyuz/tests/test_archive.py (+8/-0)
To merge this branch: bzr merge lp:~stevenk/launchpad/archive-validate-stringfix
Reviewer Review Type Date Requested Status
Henning Eggers (community) code 2010-12-13 Approve on 2010-12-13
Review via email: mp+43496@code.launchpad.net

Commit Message

[r=henninge][ui=none][bug=682548] Fix the error returned by validatePPA() if the requestor is a team.

Description of the Change

This branch changes the error returned by validatePPA() if the person is in fact a team.

To post a comment you must log in.
Henning Eggers (henninge) wrote :

Thank you for this nice little improvement. ;)

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/soyuz/model/archive.py'
2--- lib/lp/soyuz/model/archive.py 2010-12-09 11:03:53 +0000
3+++ lib/lp/soyuz/model/archive.py 2010-12-13 06:53:50 +0000
4@@ -1733,7 +1733,11 @@
5 except NoSuchPPA:
6 return None
7 else:
8- return "You already have a PPA named '%s'." % proposed_name
9+ text = "You already have a PPA named '%s'." % proposed_name
10+ if person.isTeam():
11+ text = "%s already has a PPA named '%s'." % (
12+ person.displayname, proposed_name)
13+ return text
14
15 def getPockets(self):
16 """See `IArchive`."""
17
18=== modified file 'lib/lp/soyuz/tests/test_archive.py'
19--- lib/lp/soyuz/tests/test_archive.py 2010-12-09 11:03:53 +0000
20+++ lib/lp/soyuz/tests/test_archive.py 2010-12-13 06:53:50 +0000
21@@ -23,6 +23,7 @@
22 )
23 from lp.app.errors import NotFoundError
24 from lp.buildmaster.enums import BuildStatus
25+from lp.registry.interfaces.person import TeamSubscriptionPolicy
26 from lp.registry.interfaces.pocket import PackagePublishingPocket
27 from lp.registry.interfaces.series import SeriesStatus
28 from lp.services.job.interfaces.job import JobStatus
29@@ -1446,6 +1447,13 @@
30 self.assertEqual("You already have a PPA named 'ppa'.",
31 Archive.validatePPA(ppa.owner, 'ppa'))
32
33+ def test_two_ppas_with_team(self):
34+ team = self.factory.makeTeam(
35+ subscription_policy=TeamSubscriptionPolicy.MODERATED)
36+ ppa = self.factory.makeArchive(owner=team, name='ppa')
37+ self.assertEqual("%s already has a PPA named 'ppa'." % (
38+ team.displayname), Archive.validatePPA(team, 'ppa'))
39+
40 def test_valid_ppa(self):
41 ppa_owner = self.factory.makePerson()
42 self.assertEqual(None, Archive.validatePPA(ppa_owner, None))