コード例 #1
0
 def test_report_view_notloggedin(self):
     need = AN_UNSAVED_NEED()
     need.save()
     response = self.client.post(reverse('moderation_report', args=[],
         kwargs={'app_label': need._meta.app_label,
                 'model_name': need._meta.module_name,
                 'obj_id': need.id}),
         {'reason': Report.SPAM, 'comment': 'Testing'})
     content = simplejson.loads(response.content)
     self.assertEqual(content['success'], 'false')
コード例 #2
0
    def test_create_report(self):
        """You need to set ADMINS on your settings file for this test"""
        user = self.login_user(username='******')
        need = AN_UNSAVED_NEED()
        need.save()
        moderation = Moderation.objects.get_for_object(need)
        self.assertFalse(moderation)

        report = create_report(obj=need, user=user, reason=Report.ANOTHER,
                               comment='Testing')
        moderation = Moderation.objects.get_for_object(need)[0]
        self.assertEqual(moderation.reports.count(), 1)
        self.assertQuerysetEqual(moderation.reports.filter(user=user),
                map(repr, [report]))

        self.assertEqual(len(mail.outbox), 1)
コード例 #3
0
ファイル: tests.py プロジェクト: frduda/mootiro-maps
def AN_UNSAVED_PROPOSAL():
    need = AN_UNSAVED_NEED()
    need.save()
    return Proposal(title="Resolver", description="lorem ipsum", need=need)
コード例 #4
0
 def setUp(self):
     self.need = AN_UNSAVED_NEED()
コード例 #5
0
ファイル: tests.py プロジェクト: CodingForChange/mootiro-maps
def AN_UNSAVED_PROPOSAL():
    need = AN_UNSAVED_NEED()
    need.save()
    return Proposal(title="Resolver", description="lorem ipsum", need=need)