Commit 7deb8d8e authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

test fixes

parent 14a993bc8d1e
......@@ -15,9 +15,9 @@ from logilab.common.compat import any
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 @@ class EntityFieldsFormTC(CubicWebTC):
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 @@ class EntityFieldsFormTC(CubicWebTC):
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'
......
......@@ -39,7 +39,7 @@ class UrlRewriteTC(CubicWebTC):
('/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')),
......
......@@ -15,7 +15,7 @@ from cubicweb.devtools.testlib import CubicWebTC
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 @@ class EditControllerTC(CubicWebTC):
'__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,
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment