fix unit tests
authorraph
Mon, 17 May 2010 15:07:30 +0200
changeset 278 3d25afbd78ff
parent 277 588ca38ccb61
child 279 46b0773c20c1
fix unit tests
src/cm/denorm_engine.py
src/cm/fixtures/test_comments.json
src/cm/tests/test_comment_positioning.py
src/cm/tests/test_history.py
src/cm/tests/test_notifications.py
src/cm/tests/test_structure.py
--- a/src/cm/denorm_engine.py	Fri May 14 15:17:44 2010 +0200
+++ b/src/cm/denorm_engine.py	Mon May 17 15:07:30 2010 +0200
@@ -18,7 +18,8 @@
         text = text_version.text
         text.update_denorm_fields()
     except Text.DoesNotExist:
-        logging.warning('No text found for text_version: %i' %text_version.id)
+        pass
+        #logging.warning('No text found for text_version: %i' %text_version.id)
         
         
 def connect_all():
--- a/src/cm/fixtures/test_comments.json	Fri May 14 15:17:44 2010 +0200
+++ b/src/cm/fixtures/test_comments.json	Mon May 17 15:07:30 2010 +0200
@@ -18,6 +18,7 @@
       "content": "simple text <p>simple text</p> <p>simple text</p> <p>simple text</p> <p>simple text</p> <p>simple text</p> <p>simple text</p> <p>simple text</p> <p>simple text</p> <p>simple text</p> <p>simple text</p> <p>simple text</p> <p>simple text</p> <p>simple text</p> <p>simple text</p> <p>simple text</p> <p>simple text</p> <p>simple text</p>", 
       "created": "2009-02-13 03:27:05", 
       "format": "html", 
+      "key": "keyTextVersion", 
       "modified": "2009-02-13 03:27:05", 
       "note": "ma note", 
       "text": 1, 
--- a/src/cm/tests/test_comment_positioning.py	Fri May 14 15:17:44 2010 +0200
+++ b/src/cm/tests/test_comment_positioning.py	Mon May 17 15:07:30 2010 +0200
@@ -55,32 +55,32 @@
                 self.assert_comment(id, x, y, z, k) 
             
     def test_wrapper_shifted(self):
-        content     = """<html><body>This is a <b>test</b> text</body></html>"""
-        new_content = """<html><body>This is a <b>te</b>e<b>est</b> text</body></html>"""
+        content     = u"""<html><body>This is a <b>test</b> text</body></html>"""
+        new_content = u"""<html><body>This is a <b>te</b>e<b>est</b> text</body></html>"""
         self.preserve_comment_pos(content, new_content, [([2,2,2,4],[4,4,2,4]),])
 
     def test_comment_removed(self):
-        content     = """<html><body>This is a <b>test</b> text</body></html>"""
-        new_content = """<html><body>This is a <b>test</b> txt</body></html>"""
+        content     = u"""<html><body>This is a <b>test</b> text</body></html>"""
+        new_content = u"""<html><body>This is a <b>test</b> txt</body></html>"""
         self.preserve_comment_pos(content, new_content, [([2,2,2,4],None),])
 
     def test_offset_shifted(self):
-        content     = """<html><body>This is a <b>test</b> text</body></html>"""
-        new_content = """<html><body>a <b>teXXXst</b>a text</body></html>"""
+        content     = u"""<html><body>This is a <b>test</b> text</body></html>"""
+        new_content = u"""<html><body>a <b>teXXXst</b>a text</body></html>"""
         self.preserve_comment_pos(content, new_content, [([2,2,2,4],[2,2,3,5]),])
 
     def test_insert_wrapper(self):
-        content     = """<html><body>This is a <b>test</b> text</body></html>"""
-        new_content = """<html><body>This is a <b>test</b> te<b>x</b>t</body></html>"""
+        content     = u"""<html><body>This is a <b>test</b> text</body></html>"""
+        new_content = u"""<html><body>This is a <b>test</b> te<b>x</b>t</body></html>"""
         self.preserve_comment_pos(content, new_content, [([2,2,2,5],[2,4,2,1]),])
 
     def test_multiwrapper(self):
-        content     = """<html><body>This is a <b>test</b> text</body></html>"""
-        new_content = """<html><body>This is a <b>testXXX<b>X</b>XXXXXXX</b>X text</body></html>"""
+        content     = u"""<html><body>This is a <b>test</b> text</body></html>"""
+        new_content = u"""<html><body>This is a <b>testXXX<b>X</b>XXXXXXX</b>X text</body></html>"""
         self.preserve_comment_pos(content, new_content, [([0,2,2,4],None),])
 
-    def test_insert_wrapper(self):
-        content     = """<html><body>aa<b>test</b>bb</body></html>"""
-        new_content     = """<html><body>aXa<b>test</b>bXb</body></html>"""
+    def test_insert_wrapper2(self):
+        content     = u"""<html><body>aa<b>test</b>bb</body></html>"""
+        new_content = u"""<html><body>aXa<b>test</b>bXb</body></html>"""
         self.preserve_comment_pos(content, new_content, [([0,2,1,1],[0,2,2,1]),])
 
--- a/src/cm/tests/test_history.py	Fri May 14 15:17:44 2010 +0200
+++ b/src/cm/tests/test_history.py	Mon May 17 15:07:30 2010 +0200
@@ -9,8 +9,6 @@
     
     def test_revert(self):
         text = Text.objects.all()[0]
-        #for i in range(1,text.get_versions_number()+1):
-        text_version = Text.last_text_version
+        text_version = text.last_text_version
         text.revert_to_version(text_version.key)
-        #self.assertEqual(Comment.objects.count(), 16)
 
--- a/src/cm/tests/test_notifications.py	Fri May 14 15:17:44 2010 +0200
+++ b/src/cm/tests/test_notifications.py	Mon May 17 15:07:30 2010 +0200
@@ -19,7 +19,7 @@
 
         # subscribe to workspace notifications
         response = c.post('/followup/', {'notif_id': u'workspace_notify_check', 
-                                         'workspace_notify_check': u'workspace_notify_check',
+                                         'workspace_notify_check': u'true',
                                          })
 
         self.assertEquals(len(Notification.objects.all()), 1)
--- a/src/cm/tests/test_structure.py	Fri May 14 15:17:44 2010 +0200
+++ b/src/cm/tests/test_structure.py	Mon May 17 15:07:30 2010 +0200
@@ -25,7 +25,7 @@
         # edit with duplication changing content
         new_text = text.edit(new_title='my title', 
                   new_format='html', 
-                  new_content='simple text <p>simple text</p> <p>simple text</p> ', 
+                  new_content=u'simple text <p>simple text</p> <p>simple text</p> ', 
                   keep_comments = True, 
                   cancel_modified_scopes=False,                  
                   new_version = True)
@@ -35,7 +35,7 @@
         # edit without duplication, completely changing content
         new_text = text.edit(new_title='my title', 
                   new_format='html', 
-                  new_content='xxxxxx', 
+                  new_content=u'xxxxxx', 
                   keep_comments = True, 
                   cancel_modified_scopes=False,                  
                   new_version = False)
@@ -48,7 +48,7 @@
         text = Text.objects.all()[0]
         new_text = text.edit(new_title='my title', 
                   new_format='html', 
-                  new_content='xxxxxx', 
+                  new_content=u'xxxxxx', 
                   keep_comments = False, 
                   cancel_modified_scopes=False,                  
                   new_version = False)
@@ -61,7 +61,7 @@
         text = Text.objects.all()[0]
         new_text = text.edit(new_title='my title', 
                   new_format='html', 
-                  new_content='xxxxxx', 
+                  new_content=u'xxxxxx', 
                   keep_comments = False, 
                   cancel_modified_scopes=False,                  
                   new_version = True)