def test_with_revision_addressees(self): db.session.add(ProjectOption(project=self.project, name="mail.notify-author", value="1")) db.session.add( ProjectOption( project=self.project, name="mail.notify-addresses-revisions", value="[email protected], [email protected]" ) ) author = self.create_author("*****@*****.**") patch = Patch(repository=self.repo, project=self.project, label="foo", diff="") source = self.create_source(self.project, patch=patch) build = self.create_build(project=self.project, source=source, author=author, result=Result.failed) job = self.create_job(build=build) db.session.commit() handler = MailNotificationHandler() recipients = handler.get_recipients(job) assert recipients == ["{0} <*****@*****.**>".format(author.name)] build = self.create_build(project=self.project, result=Result.failed, author=author) job = self.create_job(build=build) job_finished_handler(job) handler = MailNotificationHandler() recipients = handler.get_recipients(job) assert recipients == ["{0} <*****@*****.**>".format(author.name), "*****@*****.**", "*****@*****.**"]
def test_with_revision_addressees(self): db.session.add( ProjectOption(project=self.project, name='mail.notify-author', value='1')) db.session.add( ProjectOption(project=self.project, name='mail.notify-addresses-revisions', value='[email protected], [email protected]')) author = self.create_author('*****@*****.**') patch = Patch( repository=self.repo, project=self.project, label='foo', diff='', ) source = self.create_source(self.project, patch=patch) build = self.create_build( project=self.project, source=source, author=author, result=Result.failed, ) job = self.create_job(build=build) db.session.commit() handler = MailNotificationHandler() recipients = handler.get_recipients(job) assert recipients == ['{0} <*****@*****.**>'.format(author.name)] build = self.create_build( project=self.project, result=Result.failed, author=author, ) job = self.create_job(build=build) job_finished_handler(job) handler = MailNotificationHandler() recipients = handler.get_recipients(job) assert recipients == [ '{0} <*****@*****.**>'.format(author.name), '*****@*****.**', '*****@*****.**', ]
def test_with_addressees(self): db.session.add( ProjectOption(project=self.project, name='mail.notify-author', value='1')) db.session.add( ProjectOption(project=self.project, name='mail.notify-addresses', value='[email protected], [email protected]')) author = self.create_author('*****@*****.**') build = self.create_build(self.project, result=Result.failed, author=author) job = self.create_job(build) db.session.commit() handler = MailNotificationHandler() recipients = handler.get_recipients(job) assert recipients == [ '{0} <*****@*****.**>'.format(author.name), '*****@*****.**', '*****@*****.**', ]
def test_default_options(self): author = self.create_author('*****@*****.**') build = self.create_build(self.project, result=Result.passed, author=author) job = self.create_job(build) handler = MailNotificationHandler() recipients = handler.get_recipients(job) assert recipients == ['{0} <*****@*****.**>'.format(author.name)]
def test_with_revision_addressees(self): db.session.add(ProjectOption( project=self.project, name='mail.notify-author', value='1')) db.session.add(ProjectOption( project=self.project, name='mail.notify-addresses-revisions', value='[email protected], [email protected]')) author = self.create_author('*****@*****.**') patch = Patch( repository=self.repo, project=self.project, label='foo', diff='', ) source = self.create_source(self.project, patch=patch) build = self.create_build( project=self.project, source=source, author=author, result=Result.failed, ) job = self.create_job(build=build) db.session.commit() handler = MailNotificationHandler() recipients = handler.get_recipients(job) assert recipients == ['{0} <*****@*****.**>'.format(author.name)] build = self.create_build( project=self.project, result=Result.failed, author=author, ) job = self.create_job(build=build) job_finished_handler(job) handler = MailNotificationHandler() recipients = handler.get_recipients(job) assert recipients == [ '{0} <*****@*****.**>'.format(author.name), '*****@*****.**', '*****@*****.**', ]
def test_default_options(self): project = self.create_project() author = self.create_author('*****@*****.**') build = self.create_build(project, result=Result.passed, author=author) job = self.create_job(build) handler = MailNotificationHandler() recipients = handler.get_recipients(job) assert recipients == ['{0} <*****@*****.**>'.format(author.name)]
def test_without_author_option(self): db.session.add(ProjectOption(project=self.project, name="mail.notify-author", value="0")) author = self.create_author("*****@*****.**") build = self.create_build(self.project, result=Result.failed, author=author) job = self.create_job(build) db.session.commit() handler = MailNotificationHandler() recipients = handler.get_recipients(job) assert recipients == []
def test_without_author_option(self): project = self.create_project() db.session.add( ProjectOption(project=project, name='mail.notify-author', value='0')) author = self.create_author('*****@*****.**') build = self.create_build(project, result=Result.failed, author=author) job = self.create_job(build) db.session.commit() handler = MailNotificationHandler() recipients = handler.get_recipients(job) assert recipients == []
def test_with_addressees(self): db.session.add(ProjectOption(project=self.project, name="mail.notify-author", value="1")) db.session.add( ProjectOption(project=self.project, name="mail.notify-addresses", value="[email protected], [email protected]") ) author = self.create_author("*****@*****.**") build = self.create_build(self.project, result=Result.failed, author=author) job = self.create_job(build) db.session.commit() handler = MailNotificationHandler() recipients = handler.get_recipients(job) assert recipients == ["{0} <*****@*****.**>".format(author.name), "*****@*****.**", "*****@*****.**"]
def test_with_addressees(self): db.session.add(ProjectOption( project=self.project, name='mail.notify-author', value='1')) db.session.add(ProjectOption( project=self.project, name='mail.notify-addresses', value='[email protected], [email protected]')) author = self.create_author('*****@*****.**') build = self.create_build(self.project, result=Result.failed, author=author) job = self.create_job(build) db.session.commit() handler = MailNotificationHandler() recipients = handler.get_recipients(job) assert recipients == [ '{0} <*****@*****.**>'.format(author.name), '*****@*****.**', '*****@*****.**', ]