Permalink
Browse files

Add AKISMET_IS_TEST setting to run Akismet in test mode.

  • Loading branch information...
1 parent 48affda commit c6e105e8c1530b66cc75fa210fef433a70c222e6 @vdboor vdboor committed Nov 11, 2012
Showing with 6 additions and 0 deletions.
  1. +1 −0 fluent_comments/appsettings.py
  2. +5 −0 fluent_comments/moderation.py
@@ -3,6 +3,7 @@
AKISMET_API_KEY = getattr(settings, 'AKISMET_API_KEY', None)
AKISMET_BLOG_URL = getattr(settings, 'AKISMET_BLOG_URL', None) # Optional, to override auto detection
+AKISMET_IS_TEST = getattr(settings, 'AKISMET_IS_TEST', False) # Enable in case of testing
CRISPY_TEMPLATE_PACK = getattr(settings, 'CRISPY_TEMPLATE_PACK', 'bootstrap')
@@ -147,6 +147,11 @@ def _get_akismet_data(self, blog_url, comment, content_object, request):
'HTTP_ACCEPT': request.META.get('HTTP_ACCEPT', ''),
}
+ # Allow testing, see:
+ # http://blog.akismet.com/2012/07/20/pro-tip-testing-testing/
+ if appsettings.AKISMET_IS_TEST:
+ akismet_data['is_test'] = '1'
+
return akismet_data

0 comments on commit c6e105e

Please sign in to comment.