# HG changeset patch # User gibus # Date 1394532397 -3600 # Node ID 52f3e090eed98befc8fda0c5d22e97c0ce0694b1 # Parent 830993bdf983872e310f7be8660cbdf81e5c5b94 make django tests working again, from ymh, see http://www.iri.centrepompidou.fr/dev/hg/comt/rev/e103299bccc0 diff -r 830993bdf983 -r 52f3e090eed9 src/cm/activity.py --- a/src/cm/activity.py Tue Mar 11 11:05:25 2014 +0100 +++ b/src/cm/activity.py Tue Mar 11 11:06:37 2014 +0100 @@ -31,7 +31,7 @@ originator_user = request.user if STORE_ACTIVITY_IP: - ip = request.META['REMOTE_ADDR'] + ip = request.META.get('REMOTE_ADDR', '0.0.0.0') else: ip = None diff -r 830993bdf983 -r 52f3e090eed9 src/cm/tests/test_api.py --- a/src/cm/tests/test_api.py Tue Mar 11 11:05:25 2014 +0100 +++ b/src/cm/tests/test_api.py Tue Mar 11 11:06:37 2014 +0100 @@ -22,7 +22,7 @@ self.user = user class APITest(TestCase): - fixtures = ['roles_generic', 'test_content', ] + fixtures = ['initial_data','roles_generic', 'test_content', ] def test_text_get(self): """ diff -r 830993bdf983 -r 52f3e090eed9 src/cm/tests/test_comment_positioning.py --- a/src/cm/tests/test_comment_positioning.py Tue Mar 11 11:05:25 2014 +0100 +++ b/src/cm/tests/test_comment_positioning.py Tue Mar 11 11:06:37 2014 +0100 @@ -2,6 +2,7 @@ from django.test import TestCase from BeautifulSoup import BeautifulSoup from cm.models import * +from django.core.cache import cache # python manage.py test #  @@ -20,6 +21,7 @@ reply_to=reply_to, state=state, user=user) + cache.clear() return co diff -r 830993bdf983 -r 52f3e090eed9 src/cm/tests/test_notifications.py --- a/src/cm/tests/test_notifications.py Tue Mar 11 11:05:25 2014 +0100 +++ b/src/cm/tests/test_notifications.py Tue Mar 11 11:06:37 2014 +0100 @@ -7,7 +7,7 @@ from cm.models_utils import * class NotificationTest(TestCase): - fixtures = ['roles_generic','test_content'] + fixtures = ['initial_data', 'roles_generic','test_content'] def setUp(self): pass diff -r 830993bdf983 -r 52f3e090eed9 src/cm/tests/test_security.py --- a/src/cm/tests/test_security.py Tue Mar 11 11:05:25 2014 +0100 +++ b/src/cm/tests/test_security.py Tue Mar 11 11:06:37 2014 +0100 @@ -1,7 +1,7 @@ from django.test import TestCase from django.test.client import Client from django.core import management - +from django.core.cache import cache from cm.models import * from cm.security import * @@ -12,7 +12,7 @@ self.user = user class SecurityTest(TestCase): - fixtures = ['roles_generic','test_content'] + fixtures = ['initial_data', 'roles_generic','test_content'] def test_access_rights(self): # anon user sees no text @@ -53,6 +53,7 @@ c2.save() c3.state = 'approved' c3.save() + cache.clear() self.assertFalse(has_own_perm(FalseRequest(user3), "can_edit_comment" + "_own", text2, c3),'CANNOT edit own comment (there is a reply)') self.assertTrue(has_own_perm(FalseRequest(user2), "can_edit_comment" + "_own", text2, c2),"CAN edit own comment (is moderator)") @@ -77,4 +78,4 @@ self.assertFalse(has_own_perm(FalseRequest(user3), "can_edit_comment" + "_own", text2, c3),'CANNOT edit own comment (there is a reply)') self.assertTrue(has_perm(FalseRequest(user2), "can_edit_comment", text2),"CAN edit other's comment (moderator)") - \ No newline at end of file +