97
def makeChangesFile(self, spph, maintainer, maintainer_address):
97
def makeChangesFile(self, spph, maintainer, maintainer_address,
98
changer, changer_address):
98
99
maintainer_key = self.factory.makeGPGKey(maintainer)
99
100
temp_dir = self.makeTemporaryDirectory()
100
101
changes_file = os.path.join(
101
102
temp_dir, "%s.changes" % spph.source_package_name)
102
open(changes_file, 'w').write(
103
"Maintainer: %s <%s>\n" % (maintainer.name, maintainer_address))
103
with open(changes_file, 'w') as changes:
105
"Maintainer: %s <%s>\n"
106
"Changed-By: %s <%s>\n"
104
113
return FakeChangesFile(spph, changes_file, maintainer_key)
106
def makeNascentUpload(self, spph, maintainer, maintainer_address):
115
def makeNascentUpload(self, spph, maintainer, maintainer_address,
116
changer, changer_address):
107
117
"""Create a `NascentUpload` for `spph`."""
118
changes = self.makeChangesFile(
119
spph, maintainer, maintainer_address, changer, changer_address)
108
120
upload = NascentUpload(
109
self.makeChangesFile(spph, maintainer, maintainer_address),
110
FakeUploadPolicy(spph), DevNullLogger())
121
changes, FakeUploadPolicy(spph), DevNullLogger())
111
122
upload.queue_root = upload._createQueueEntry()
112
123
das = self.factory.makeDistroArchSeries(
113
124
distroseries=spph.distroseries)
131
142
def test_maintainer_not_notified_about_build_failure_elsewhere(self):
132
143
"""No mail to maintainers about builds they're not responsible for.
135
145
We import Debian source packages, then sync them into Ubuntu (and
136
146
from there, into Ubuntu-derived distros). Those syncs then trigger
137
147
builds that the original Debian maintainers are not responsible for.
139
In a situation like that, we should not bother the maintainer with
140
the failure. We notify the person who requested the sync instead.
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.
142
153
This test guards against bug 876594.
144
155
maintainer, maintainer_address = self.makePersonWithEmail()
156
changer, changer_address = self.makePersonWithEmail()
145
157
dsp = self.factory.makeDistroSeriesParent()
146
158
original_spph = self.makeSPPH(dsp.parent_series, maintainer_address)
147
159
sync_requester, syncer_address = self.makePersonWithEmail()
148
160
synced_spph = self.syncSource(
149
161
original_spph, dsp.derived_series, sync_requester)
150
162
nascent_upload = self.makeNascentUpload(
151
synced_spph, maintainer, maintainer_address)
163
synced_spph, maintainer, maintainer_address,
164
changer, changer_address)
152
165
pop_notifications()
153
166
self.processAndRejectUpload(nascent_upload)
155
168
notified_addresses = '\n'.join(self.getNotifiedAddresses())
157
170
self.assertNotIn(maintainer_address, notified_addresses)
171
self.assertNotIn(changer_address, notified_addresses)
158
172
self.assertIn(syncer_address, notified_addresses)