test fixes
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 27 Jan 2010 09:57:16 +0100
changeset 4390 0285c1fa1459
parent 4389 14a993bc8d1e
child 4391 bd8480824e0b
test fixes
web/test/unittest_form.py
web/test/unittest_urlrewrite.py
web/test/unittest_views_basecontrollers.py
--- a/web/test/unittest_form.py	Wed Jan 27 09:56:58 2010 +0100
+++ b/web/test/unittest_form.py	Wed Jan 27 09:57:16 2010 +0100
@@ -15,9 +15,9 @@
 from cubicweb import Binary
 from cubicweb.devtools.testlib import CubicWebTC
 from cubicweb.web.formfields import (IntField, StringField, RichTextField,
-                                     PasswordField, DateTimeField, DateTimePicker,
+                                     PasswordField, DateTimeField,
                                      FileField, EditableFileField)
-from cubicweb.web.formwidgets import PasswordInput, Input
+from cubicweb.web.formwidgets import PasswordInput, Input, DateTimePicker
 from cubicweb.web.views.forms import EntityFieldsForm, FieldsForm
 from cubicweb.web.views.workflow import ChangeStateForm
 from cubicweb.web.views.formrenderers import FormRenderer
@@ -67,10 +67,10 @@
         e = self.vreg['etypes'].etype_class('CWUser')(self.request())
         e.eid = 'A'
         form = EntityFieldsForm(self.request(login=u'toto'), None, entity=e)
-        field = StringField(name='login', eidparam=True)
+        field = StringField(name='login', role='subject', eidparam=True)
         form.append_field(field)
         form.build_context({})
-        self.assertEquals(field.display_value(form), 'toto')
+        self.assertEquals(field.widget.values(form, field), (u'toto',))
 
 
     def test_linkto_field_duplication(self):
@@ -130,7 +130,8 @@
     def _test_richtextfield(self, expected):
         class RTFForm(EntityFieldsForm):
             description = RichTextField(eidparam=True, role='subject')
-        state = self.execute('State X WHERE X name "activated", X state_of WF, WF workflow_of ET, ET name "CWUser"').get_entity(0, 0)
+        state = self.vreg['etypes'].etype_class('State')(self.req)
+        state.eid = 'S'
         form = RTFForm(self.req, redirect_path='perdu.com', entity=state)
         # make it think it can use fck editor anyway
         form.field_by_name('description', 'subject').format = lambda x: 'text/html'
--- a/web/test/unittest_urlrewrite.py	Wed Jan 27 09:56:58 2010 +0100
+++ b/web/test/unittest_urlrewrite.py	Wed Jan 27 09:57:16 2010 +0100
@@ -39,7 +39,7 @@
             ('/notfound', dict(vid='404')),
             ('/error', dict(vid='error')),
             ('/sparql', dict(vid='sparql')),
-            ('/schema/([^/]+?)/?$', {'rql': r'Any X WHERE X is CWEType, X name "\1"', 'vid': 'eschema'}),
+            ('/schema/([^/]+?)/?$', {'rql': r'Any X WHERE X is CWEType, X name "\1"', 'vid': 'primary'}),
             ('/add/([^/]+?)/?$' , dict(vid='creation', etype=r'\1')),
             ('/doc/images/(.+?)/?$', dict(fid='\\1', vid='wdocimages')),
             ('/doc/?$', dict(fid='main', vid='wdoc')),
--- a/web/test/unittest_views_basecontrollers.py	Wed Jan 27 09:56:58 2010 +0100
+++ b/web/test/unittest_views_basecontrollers.py	Wed Jan 27 09:57:16 2010 +0100
@@ -15,7 +15,7 @@
 from cubicweb.uilib import rql_for_eid
 from cubicweb.web import INTERNAL_FIELD_VALUE, Redirect, RequestError
 from cubicweb.entities.authobjs import CWUser
-from cubicweb.web.views.editviews import get_pending_inserts, get_pending_deletes
+from cubicweb.web.views.autoform import get_pending_inserts, get_pending_deletes
 u = unicode
 
 def req_form(user):
@@ -379,7 +379,7 @@
             '__type:'+cwetypeeid:  'CWEType',
             '_cw_edited_fields:'+cwetypeeid: 'name-subject,final-subject,description-subject,read_permission-subject',
             'name-subject:'+cwetypeeid:     u'CWEType',
-            #'final-subject:'+cwetypeeid:    False,
+            'final-subject:'+cwetypeeid:    '',
             'description-subject:'+cwetypeeid:     u'users group',
             'read_permission-subject:'+cwetypeeid:  groups,
             }