Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubicweb
Commits
0285c1fa1459
Commit
7deb8d8e
authored
Jan 27, 2010
by
Sylvain Thénault
Browse files
test fixes
parent
14a993bc8d1e
Changes
3
Hide whitespace changes
Inline
Side-by-side
web/test/unittest_form.py
View file @
0285c1fa
...
...
@@ -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
.
value
s
(
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'
...
...
web/test/unittest_urlrewrite.py
View file @
0285c1fa
...
...
@@ -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'
)),
...
...
web/test/unittest_views_basecontrollers.py
View file @
0285c1fa
...
...
@@ -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
,
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment