def test_send_notification_i18n(self): with patch('notifications.models.send_notification') as send_notification: models.send_notification_i18n( '/uri/user/testuser', 'emails/project_submitted_subject.txt', 'emails/project_submitted.txt', context={'test1': 'test123'}, callback='http://call.me' ) self.assertTrue(send_notification.called)
def send_revision_notification(project, experts): subject_template = 'emails/project_revised_subject.txt' text_template = 'emails/project_revised.txt' context = { 'project': project } for expert in experts: send_notification_i18n( expert, subject_template, text_template, context=context )
def send_project_creation_expert_notification(project, experts): subject_template = 'emails/project_submitted_expert_subject.txt' text_template = 'emails/project_submitted_expert.txt' context = { 'project': project } # send to all creation for expert in experts: send_notification_i18n( expert, subject_template, text_template, context=context )
def send_revision_notification(project, experts): subject_template = 'emails/project_revised_subject.txt' text_template = 'emails/project_revised.txt' html_template = 'emails/project_revised.html' context = { 'project': fetch_resources(project) } for expert in experts: send_notification_i18n( expert, subject_template, text_template, html_template, context=context )
def send_project_creation_expert_notification(project, badge, experts): subject_template = 'emails/project_submitted_expert_subject.txt' text_template = 'emails/project_submitted_expert.txt' html_template = 'emails/project_submitted_expert.html' context = { 'projects': [fetch_resources(project)], 'badge': badge } for expert in experts: send_notification_i18n( expert, subject_template, text_template, html_template, context=context )
def send_feedback_notification(project): subject_template = 'emails/project_feedback_subject.txt' text_template = 'emails/project_feedback.txt' context = { 'project': project } return send_notification_i18n( project['author_uri'], subject_template, text_template, context=context )
def send_project_creation_notification(project): subject_template = 'emails/project_submitted_subject.txt' text_template = 'emails/project_submitted.txt' context = { 'project': project } return send_notification_i18n( project['author_uri'], subject_template, text_template, context=context )
def send_badge_creation_notification(badge): subject_template = 'emails/badge_created_subject.txt' text_template = 'emails/badge_created.txt' context = { 'badge': badge } return send_notification_i18n( badge['author_uri'], subject_template, text_template, context=context )
def send_badge_awarded_notification(badge, expert_uri): subject_template = 'emails/badge_awarded_subject.txt' text_template = 'emails/badge_awarded.txt' context = { 'badge': badge } return send_notification_i18n( expert_uri, subject_template, text_template, context=context )
def send_project_creation_notification(project): subject_template = 'emails/project_submitted_subject.txt' text_template = 'emails/project_submitted.txt' html_template = 'emails/project_submitted.html' context = { 'project': fetch_resources(project) } return send_notification_i18n( project['author_uri'], subject_template, text_template, html_template, context=context )
def send_badge_creation_notification(badge): subject_template = 'emails/badge_created_subject.txt' text_template = 'emails/badge_created.txt' html_template = 'emails/badge_created.html' context = { 'badge': fetch_badge_resources(badge) } return send_notification_i18n( badge['author_uri'], subject_template, text_template, html_template, context=context )
def send_badge_needs_partner_feedback_notification(badge, project, author_uri): subject_template = 'emails/project_awarded_partner_badge_subject.txt' text_template = 'emails/project_awarded_partner_badge.txt' html_template = 'emails/project_awarded_partner_badge.html' context = { 'project': fetch_resources(project) } return send_notification_i18n( project['author_uri'], subject_template, text_template, html_template, context=context )
def send_badge_awarded_notification(badge, expert_uri): subject_template = 'emails/badge_awarded_subject.txt' text_template = 'emails/badge_awarded.txt' html_template = 'emails/badge_awarded.html' context = { 'badge': fetch_badge_resources(badge) } # NOT the best place to hide this dependancy!! from project import models as project_api from project.view_helpers import fetch_resources project = project_api.search_projects(badge['uri'], expert_uri) if len(project) == 1: context['project'] = fetch_resources(project[0]) projects = project_api.get_projects_ready_for_feedback(badge['uri']) context['projects'] = map(fetch_resources, projects[:3]) return send_notification_i18n( expert_uri, subject_template, text_template, html_template, context=context )