def test_msg_data(self, mock_date): """Function: test_msg_data Description: Test with msg with data. Arguments: """ mock_date.now.return_value = self.datetime mock_date.strftime.return_value = self.dtg test_body = list(self.body2) for line in self.line_list2: test_body.append(line) for key in self.msg.keys(): test_body.append("%s: %s" % (key, self.msg[key])) test_body.append("URL: " + self.gitr.url) test_body.append(self.keystr + self.gitr.git_dir) test_body.append(self.keystr2 + self.gitr.branch) test_body.append("DTG: " + self.dtg) subj, body = merge_repo.prepare_mail(self.gitr, self.status2, self.line_list2, self.msg) self.assertEqual((subj, body), (self.subj2, test_body))
def test_status_true(self, mock_date): """Function: test_status_true Description: Test with status set to True. Arguments: """ mock_date.now.return_value = self.datetime mock_date.strftime.return_value = self.dtg test_body = list(self.body) test_body.append("URL: " + self.gitr.url) test_body.append(self.keystr + self.gitr.git_dir) test_body.append(self.keystr2 + self.gitr.branch) test_body.append("DTG: " + self.dtg) subj, body = merge_repo.prepare_mail(self.gitr, self.status1) self.assertEqual((subj, body), (self.subj, test_body))
def test_linelist_empty(self, mock_date): """Function: test_linelist_empty Description: Test with line_list with empty list. Arguments: """ mock_date.now.return_value = self.datetime mock_date.strftime.return_value = self.dtg test_body = list(self.body2) test_body.append("URL: " + self.gitr.url) test_body.append(self.keystr + self.gitr.git_dir) test_body.append(self.keystr2 + self.gitr.branch) test_body.append("DTG: " + self.dtg) subj, body = merge_repo.prepare_mail(self.gitr, self.status2, self.line_list) self.assertEqual((subj, body), (self.subj2, test_body))