def test_default_options(self): project = self.create_project() author = self.create_author('*****@*****.**') build = self.create_build(project, result=Result.failed, author=author) handler = MailNotificationHandler() recipients = handler.get_build_recipients(build) 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.failed, author=author) handler = MailNotificationHandler() recipients = handler.get_build_recipients(build) assert recipients == ['{0} <*****@*****.**>'.format(author.name)]
def test_with_revision_addressees(self): project = self.create_project() db.session.add( ProjectOption(project=project, name='mail.notify-author', value='1')) db.session.add( ProjectOption(project=project, name='mail.notify-addresses-revisions', value='[email protected], [email protected]')) author = self.create_author('*****@*****.**') patch = self.create_patch(repository=project.repository) source = self.create_source(project, patch=patch) build = self.create_build( project=project, source=source, author=author, result=Result.failed, ) db.session.commit() handler = MailNotificationHandler() recipients = handler.get_build_recipients(build) assert recipients == ['{0} <*****@*****.**>'.format(author.name)] build = self.create_build( project=project, result=Result.failed, author=author, ) handler = MailNotificationHandler() recipients = handler.get_build_recipients(build) assert recipients == [ '{0} <*****@*****.**>'.format(author.name), '*****@*****.**', '*****@*****.**', ]
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) db.session.commit() handler = MailNotificationHandler() recipients = handler.get_build_recipients(build) assert recipients == []
def test_with_revision_addressees(self): project = self.create_project() db.session.add(ProjectOption( project=project, name='mail.notify-author', value='1')) db.session.add(ProjectOption( project=project, name='mail.notify-addresses-revisions', value='[email protected], [email protected]')) author = self.create_author('*****@*****.**') patch = self.create_patch(repository=project.repository) source = self.create_source(project, patch=patch) build = self.create_build( project=project, source=source, author=author, result=Result.failed, ) db.session.commit() handler = MailNotificationHandler() recipients = handler.get_build_recipients(build) assert recipients == ['{0} <*****@*****.**>'.format(author.name)] build = self.create_build( project=project, result=Result.failed, author=author, tags=['commit'], ) handler = MailNotificationHandler() recipients = handler.get_build_recipients(build) assert recipients == [ '{0} <*****@*****.**>'.format(author.name), '*****@*****.**', '*****@*****.**', ]
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) db.session.commit() handler = MailNotificationHandler() recipients = handler.get_build_recipients(build) assert recipients == []
def test_with_addressees(self): project = self.create_project() db.session.add(ProjectOption( project=project, name='mail.notify-author', value='1')) db.session.add(ProjectOption( project=project, name='mail.notify-addresses', value='[email protected], [email protected]')) author = self.create_author('*****@*****.**') build = self.create_build(project, result=Result.failed, author=author) db.session.commit() handler = MailNotificationHandler() recipients = handler.get_build_recipients(build) assert recipients == [ '{0} <*****@*****.**>'.format(author.name), '*****@*****.**', '*****@*****.**', ]
def test_with_addressees(self): project = self.create_project() db.session.add( ProjectOption(project=project, name='mail.notify-author', value='1')) db.session.add( ProjectOption(project=project, name='mail.notify-addresses', value='[email protected], [email protected]')) author = self.create_author('*****@*****.**') build = self.create_build(project, result=Result.failed, author=author) db.session.commit() handler = MailNotificationHandler() recipients = handler.get_build_recipients(build) assert recipients == [ '{0} <*****@*****.**>'.format(author.name), '*****@*****.**', '*****@*****.**', ]