incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [6/11] git commit: [#5725] Add spam checking to wiki page create/update
Date Tue, 12 Feb 2013 22:21:49 GMT
[#5725] Add spam checking to wiki page create/update


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/fd06ece5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/fd06ece5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/fd06ece5

Branch: refs/heads/cj/5685
Commit: fd06ece51a96ef478c68fe9f69cf0202dbf4c037
Parents: 76e9294
Author: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Authored: Mon Feb 11 20:52:47 2013 +0000
Committer: Dave Brondsema <dbrondsema@geek.net>
Committed: Tue Feb 12 18:04:33 2013 +0000

----------------------------------------------------------------------
 ForgeWiki/forgewiki/tests/functional/test_root.py |    6 ++++--
 ForgeWiki/forgewiki/wiki_main.py                  |    1 +
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fd06ece5/ForgeWiki/forgewiki/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/functional/test_root.py b/ForgeWiki/forgewiki/tests/functional/test_root.py
index 6e61185..7c98499 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_root.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_root.py
@@ -3,7 +3,7 @@ import os
 import Image, StringIO
 import allura
 
-from nose.tools import assert_true
+from nose.tools import assert_true, assert_equal
 
 from ming.orm.ormsession import ThreadLocalORMSession
 from mock import patch
@@ -206,7 +206,8 @@ class TestRootController(TestController):
         response = self.app.get('/wiki/tést/')
         assert 'tést' in response
 
-    def test_page_update(self):
+    @patch('forgewiki.wiki_main.g.spam_checker')
+    def test_page_update(self, spam_checker):
         self.app.get('/wiki/tést/')
         response = self.app.post(
             '/wiki/tést/update',
@@ -215,6 +216,7 @@ class TestRootController(TestController):
                 'text':'sometext',
                 'labels':'',
                 'viewable_by-0.id':'all'})
+        assert_equal(spam_checker.check.call_args[0][0], 'sometext')
         assert 'tést' in response
 
     def test_page_label_unlabel(self):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fd06ece5/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index eb05bb7..ba151da 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -653,6 +653,7 @@ class PageController(BaseController):
         else:
             self.page.labels = []
         self.page.commit()
+        g.spam_checker.check(text, artifact=self.page, user=c.user, content_type='wiki')
         g.director.create_activity(c.user, activity_verb, self.page,
                 target=c.project)
         if new_viewable_by:


Mime
View raw message