Exemplo n.º 1
0
 def test_check_if_email_has_been_sent_to_user(self):
     suggestion_services.create_new_user_contribution_scoring_model(
         self.user_a_id, 'category_a', 15)
     self.assertFalse(
         suggestion_services.check_if_email_has_been_sent_to_user(
             self.user_a_id, 'category_a'))
     suggestion_services.mark_email_has_been_sent_to_user(
         self.user_a_id, 'category_a')
     self.assertTrue(
         suggestion_services.check_if_email_has_been_sent_to_user(
             self.user_a_id, 'category_a'))
Exemplo n.º 2
0
    def test_cannot_mark_email_has_been_sent_to_user_with_no_user_scoring_model(
            self):
        suggestion_services.create_suggestion(
            suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT,
            suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id,
            self.target_version_at_submission, self.author_id, self.change,
            'test description', self.reviewer_id)

        suggestion = suggestion_services.query_suggestions([
            ('author_id', self.author_id), ('target_id', self.target_id)
        ])[0]

        with self.assertRaisesRegexp(
                Exception, 'Expected user scoring model to exist for user'):
            suggestion_services.mark_email_has_been_sent_to_user(
                'unregistered_user_id', suggestion.score_category)