~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/archiveuploader/tests/test_sync_notification.py

  • Committer: Jeroen Vermeulen
  • Date: 2012-01-06 06:07:34 UTC
  • mto: This revision was merged to the branch mainline in revision 14645.
  • Revision ID: jeroen.vermeulen@canonical.com-20120106060734-kn0khm20015ucu0b
Scenario only spammed maintainer because they signed the changes file, which isn't realistic for a build.  It's the changed-by author we're shielding from spam.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
 
46
46
 
47
47
class FakeChangesFile:
48
 
    def __init__(self, spph, file_path, maintainer_key):
 
48
    def __init__(self, spph, file_path):
49
49
        self.files = []
50
50
        self.filepath = file_path
51
51
        self.filename = os.path.basename(file_path)
52
52
        self.architectures = ['i386']
53
53
        self.suite_name = '-'.join([spph.distroseries.name, spph.pocket.name])
54
54
        self.raw_content = open(file_path).read()
55
 
        self.signingkey = maintainer_key
 
55
        self.signingkey = None
56
56
 
57
57
    checkFileName = FakeMethod([])
58
58
    processAddresses = FakeMethod([])
96
96
 
97
97
    def makeChangesFile(self, spph, maintainer, maintainer_address,
98
98
                        changer, changer_address):
99
 
        maintainer_key = self.factory.makeGPGKey(maintainer)
100
99
        temp_dir = self.makeTemporaryDirectory()
101
100
        changes_file = os.path.join(
102
101
            temp_dir, "%s.changes" % spph.source_package_name)
110
109
                    changer.name,
111
110
                    changer_address,
112
111
                    ))
113
 
        return FakeChangesFile(spph, changes_file, maintainer_key)
 
112
        return FakeChangesFile(spph, changes_file)
114
113
 
115
114
    def makeNascentUpload(self, spph, maintainer, maintainer_address,
116
115
                          changer, changer_address):
139
138
        """Get email addresses that were notified."""
140
139
        return [message['to'] for message in pop_notifications()]
141
140
 
142
 
    def test_maintainer_not_notified_about_build_failure_elsewhere(self):
143
 
        """No mail to maintainers about builds they're not responsible for.
 
141
    def test_failed_copy_builds_do_not_spam_upstream(self):
 
142
        """Failed builds do not spam people who are not responsible for them.
144
143
 
145
144
        We import Debian source packages, then sync them into Ubuntu (and
146
145
        from there, into Ubuntu-derived distros).  Those syncs then trigger
147
 
        builds that the original Debian maintainers are not responsible for.
148
 
 
149
 
        In a situation like that, we should not bother the maintainer or
150
 
        the author of the last change with the failure.  We notify the
151
 
        person who requested the sync instead.
 
146
        builds that the original Debian maintainers and last-change authors
 
147
        are not responsible for.
 
148
 
 
149
        In a situation like that, we should not bother those people with the
 
150
        failure.  We notify the person who requested the sync instead.
 
151
 
 
152
        (The logic in lp.soyuz.adapters.notification may still notify the
 
153
        author of the last change, if that person is also an uploader for the
 
154
        archive that the failure happened in.  For this particular situation
 
155
        we consider that not so much an intended behaviour, as an emergent one
 
156
        that does not seem inappropriate.  It'd be hard to change if we wanted
 
157
        to.)
152
158
 
153
159
        This test guards against bug 876594.
154
160
        """