def delete_log(self, user, change=Change.ACTION_SUGGESTION_DELETE, is_spam=False): """Delete with logging change""" if is_spam and self.userdetails: report_spam( self.userdetails['address'], self.userdetails['agent'], self.target ) Change.objects.create( unit=self.unit, action=change, user=user, target=self.target, author=user ) self.delete()
def delete_log(self, user, change=Change.ACTION_SUGGESTION_DELETE, is_spam=False): """Delete with logging change""" if is_spam and self.userdetails: report_spam( self.userdetails['address'], self.userdetails['agent'], self.target ) for unit in self.related_units: Change.objects.create( unit=unit, action=change, user=user, target=self.target, author=user ) self.delete()
def test_akismet_submit_spam_error(self): self.mock_akismet("false") self.assertIsNone(report_spam("1.2.3.4", "Agent", "text"))
def test_akismet_submit_spam(self): self.mock_akismet("Thanks for making the web a better place.") self.assertIsNone(report_spam("1.2.3.4", "Agent", "text"))
def test_akismet_submit_spam_error(self): self.mock_akismet('false') self.assertIsNone(report_spam('1.2.3.4', 'Agent', 'text'))
def test_akismet_submit_spam(self): self.mock_akismet('Thanks for making the web a better place.') self.assertIsNone(report_spam('1.2.3.4', 'Agent', 'text'))
def report_spam(self): report_spam(self.userdetails["address"], self.userdetails["agent"], self.comment)
def test_akismet_submit_spam_error(self): self.mock_akismet('false') self.assertIsNone(report_spam('1.2.3.4', 'Agent', 'text'))
def test_akismet_submit_spam(self): self.mock_akismet('Thanks for making the web a better place.') self.assertIsNone(report_spam('1.2.3.4', 'Agent', 'text'))