~launchpad-pqm/launchpad/devel

14632.2.1 by Steve Kowalik
Reject uploads that have maintainers set as private teams.
1
# Copyright 2012 Canonical Ltd.  This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
4
__metaclass__ = type
5
6
from lp.archiveuploader.dscfile import SignableTagFile
7
from lp.archiveuploader.nascentuploadfile import UploadError
8
from lp.registry.interfaces.person import PersonVisibility
9
from lp.testing import (
10
    celebrity_logged_in,
11
    TestCaseWithFactory,
12
    )
13
from lp.testing.layers import DatabaseFunctionalLayer
14
15
16
class TestPrivateMaintainers(TestCaseWithFactory):
17
18
    layer = DatabaseFunctionalLayer
19
14632.2.2 by Steve Kowalik
Remove one case entirely.
20
    def test_private_team_maintainer(self):
21
        # Maintainers can not be private teams.
14632.2.1 by Steve Kowalik
Reject uploads that have maintainers set as private teams.
22
        with celebrity_logged_in('admin'):
14632.2.3 by Steve Kowalik
Lint.
23
            self.factory.makeTeam(
14632.2.1 by Steve Kowalik
Reject uploads that have maintainers set as private teams.
24
                email="foo@bar.com", visibility=PersonVisibility.PRIVATE)
25
        sigfile = SignableTagFile()
26
        self.assertRaisesWithContent(
27
            UploadError, 'Invalid Maintainer.', sigfile.parseAddress,
28
            "foo@bar.com")