You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/04/24 19:16:33 UTC

[24/28] git commit: [#2835] make solarize test cases independent

[#2835] make solarize test cases independent


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

Branch: refs/heads/db/2835
Commit: bb9a5021f11167794ce28a66292c837e060f1a60
Parents: 57cf03a
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Apr 17 19:47:21 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Apr 24 16:34:43 2013 +0000

----------------------------------------------------------------------
 Allura/allura/tests/unit/test_solr.py |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/bb9a5021/Allura/allura/tests/unit/test_solr.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/test_solr.py b/Allura/allura/tests/unit/test_solr.py
index e1b67c8..5226f07 100644
--- a/Allura/allura/tests/unit/test_solr.py
+++ b/Allura/allura/tests/unit/test_solr.py
@@ -50,26 +50,27 @@ class TestSolr(unittest.TestCase):
 
 class TestSolarize(unittest.TestCase):
 
-    def setUp(self):
-        self.obj = mock.MagicMock()
-        self.obj.index.return_value = {}
-
     def test_no_object(self):
         assert_equal(solarize(None), None)
 
     def test_empty_index(self):
-        self.obj.index.return_value = None
-        assert_equal(solarize(self.obj), None)
+        obj = mock.MagicMock()
+        obj.index.return_value = None
+        assert_equal(solarize(obj), None)
 
     def test_doc_without_text(self):
-        assert_equal(solarize(self.obj), {'text': ''})
+        obj = mock.MagicMock()
+        obj.index.return_value = {}
+        assert_equal(solarize(obj), {'text': ''})
 
     def test_strip_markdown(self):
-        self.obj.index.return_value = {'text': '# Header'}
-        assert_equal(solarize(self.obj), {'text': 'Header'})
+        obj = mock.MagicMock()
+        obj.index.return_value = {'text': '# Header'}
+        assert_equal(solarize(obj), {'text': 'Header'})
 
     def test_html_in_text(self):
-        self.obj.index.return_value = {'text': '<script>alert(1)</script>'}
-        assert_equal(solarize(self.obj), {'text': ''})
-        self.obj.index.return_value = {'text': '&lt;script&gt;alert(1)&lt;/script&gt;'}
-        assert_equal(solarize(self.obj), {'text': '&lt;script&gt;alert(1)&lt;/script&gt;'})
+        obj = mock.MagicMock()
+        obj.index.return_value = {'text': '<script>alert(1)</script>'}
+        assert_equal(solarize(obj), {'text': ''})
+        obj.index.return_value = {'text': '&lt;script&gt;alert(1)&lt;/script&gt;'}
+        assert_equal(solarize(obj), {'text': '&lt;script&gt;alert(1)&lt;/script&gt;'})