示例#1
0
 def test_email_send(self):
     days_had_system_for = 1
     testing = False
     reservation_type = u'manual'
     identify_nags(days_had_system_for, reservation_type, testing)
     self.assertEqual(len(self.mail_capture.captured_mails), 1)
     self.assert_('%s %s' % (self.subject_header, self.system_3.fqdn) in
         self.mail_capture.captured_mails[0][2])
示例#2
0
 def test_nag_email_dry_run(self):
     days_had_system_for = 1
     testing = True
     reservation_type = u'manual'
     f =  TemporaryFile()
     orig_out = sys.stdout
     sys.stdout = f
     identify_nags(days_had_system_for, reservation_type, testing)
     f.seek(0)
     nag_output = f.read()
     f.close()
     sys.stdout = orig_out #reset stdout back to original pointer
     self.assertEqual(len(self.mail_capture.captured_mails), 0)
     self.assert_('%s %s' % (self.subject_header, self.system_1.fqdn) not in nag_output)
     self.assert_('%s %s' % (self.subject_header, self.system_2.fqdn) not in nag_output)
     self.assert_('%s %s' % (self.subject_header, self.system_3.fqdn) in nag_output)