def test_notify_parse_error(self): notify_parse_error( self.component, self.get_translation(), 'Failed merge', 'test/file.po', ) # Check mail (second one is for admin) self.assertEqual(len(mail.outbox), 2) self.assertEqual( mail.outbox[0].subject, '[Weblate] Parse error in Test/Test' ) # Add project owner self.component.project.add_user(self.second_user(), '@Administration') notify_parse_error( self.component, self.get_translation(), 'Error\nstatus', 'test/file.po', ) # Check mail (second one is for admin) self.assertEqual(len(mail.outbox), 5)
def notify_change(change_id): from weblate.trans.models import Change from weblate.accounts.notifications import ( notify_merge_failure, notify_parse_error, notify_new_string, notify_new_contributor, notify_new_suggestion, notify_new_comment, notify_new_translation, notify_new_language, ) change = Change.objects.get(pk=change_id) if change.action in (Change.ACTION_FAILED_MERGE, Change.ACTION_FAILED_REBASE): notify_merge_failure(change) elif change.action == Change.ACTION_PARSE_ERROR: notify_parse_error(change) elif change.action == Change.ACTION_NEW_STRING: notify_new_string(change) elif change.action == Change.ACTION_NEW_CONTRIBUTOR: notify_new_contributor(change) elif change.action == Change.ACTION_SUGGESTION: notify_new_suggestion(change) elif change.action == Change.ACTION_COMMENT: notify_new_comment(change) elif change.action in Change.ACTIONS_CONTENT: notify_new_translation(change) elif change.action in (Change.ACTION_ADDED_LANGUAGE, Change.ACTION_REQUESTED_LANGUAGE): notify_new_language(change)
def test_notify_parse_error(self): notify_parse_error( self.component, self.get_translation(), 'Failed merge', 'test/file.po', ) # Check mail (second one is for admin) self.assertEqual(len(mail.outbox), 2) self.assertEqual( mail.outbox[0].subject, '[Weblate] Parse error in Test/Test' ) # Add project owner self.component.project.add_user(self.second_user(), '@Administration') notify_parse_error( self.component, self.get_translation(), 'Error\nstatus', 'test/file.po', ) # Check mail (second one is for admin) self.assertEqual(len(mail.outbox), 5)
def test_notify_parse_error(self): change = Change( component=self.component, translation=self.get_translation(), details={ 'error': 'Failed merge', 'filename': 'test/file.po', }, ) notify_parse_error(change) # Check mail self.assertEqual(len(mail.outbox), 1) self.assertEqual(mail.outbox[0].subject, '[Weblate] Parse error in Test/Test') # Add project owner self.component.project.add_user(self.second_user(), '@Administration') notify_parse_error(change) # Check mail self.assertEqual(len(mail.outbox), 3)