mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-06-07 15:51:29 +00:00
email: If a package is blocked by an explicit block, don't mail
This commit is contained in:
parent
8350694348
commit
e00d86ad26
@ -162,7 +162,8 @@ class EmailPolicy(BasePolicy, Rest):
|
|||||||
version = source_data_srcdist.version
|
version = source_data_srcdist.version
|
||||||
age = excuse.daysold or 0
|
age = excuse.daysold or 0
|
||||||
rounded_age = int(age)
|
rounded_age = int(age)
|
||||||
stuck = age >= 3
|
stuck = age >= 3 and 'block' not in excuse.reason
|
||||||
|
|
||||||
cached = self.cache.get(source_name, {}).get(version)
|
cached = self.cache.get(source_name, {}).get(version)
|
||||||
try:
|
try:
|
||||||
emails, sent_age = cached
|
emails, sent_age = cached
|
||||||
|
@ -346,6 +346,36 @@ class ET(TestBase):
|
|||||||
|
|
||||||
self.do_test([pkg], ["foo@bar.com"])
|
self.do_test([pkg], ["foo@bar.com"])
|
||||||
|
|
||||||
|
def test_email_not_sent_block_all_source(self):
|
||||||
|
'''Test that an email is not sent if the package is blocked by a
|
||||||
|
block-all source hint'''
|
||||||
|
self.create_hint('freeze', 'block-all source')
|
||||||
|
pkg = ('libc6', {'Version': '2'},
|
||||||
|
6, # daysold
|
||||||
|
['foo@bar.com'])
|
||||||
|
|
||||||
|
self.do_test([pkg], [])
|
||||||
|
|
||||||
|
def test_email_not_sent_blocked(self):
|
||||||
|
'''Test that an email is not sent if the package is blocked by a block hint'''
|
||||||
|
self.create_hint('freeze', 'block libc6')
|
||||||
|
pkg = ('libc6', {'Version': '2'},
|
||||||
|
6, # daysold
|
||||||
|
['foo@bar.com'])
|
||||||
|
|
||||||
|
self.do_test([pkg], [])
|
||||||
|
|
||||||
|
def test_email_sent_unblocked(self):
|
||||||
|
'''Test that an email is sent if the package is unblocked'''
|
||||||
|
self.create_hint('freeze', 'block libc6')
|
||||||
|
self.create_hint('laney', 'unblock libc6/2')
|
||||||
|
pkg = ('libc6', {'Version': '2',
|
||||||
|
'Depends': 'notavailable (>= 2)'},
|
||||||
|
6, # daysold
|
||||||
|
['foo@bar.com'])
|
||||||
|
|
||||||
|
self.do_test([pkg], ['foo@bar.com'])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user