--- a/entities/test/unittest_wfobjs.py Wed Oct 07 11:33:38 2009 +0200
+++ b/entities/test/unittest_wfobjs.py Wed Oct 07 11:45:39 2009 +0200
@@ -279,7 +279,7 @@
self.member.clear_all_caches()
self.assertEquals(self.member.current_workflow.eid, wf.eid)
self.assertEquals(self.member.state, 'asleep')
- self.assertEquals(self.member.workflow_history, [])
+ self.assertEquals(self.member.workflow_history, ())
def test_custom_wf_replace_state_keep_history(self):
"""member in inital state with some history, state is redirected and
--- a/server/test/unittest_ldapuser.py Wed Oct 07 11:33:38 2009 +0200
+++ b/server/test/unittest_ldapuser.py Wed Oct 07 11:45:39 2009 +0200
@@ -82,7 +82,7 @@
self.assertEquals(e.surname, None)
self.assertEquals(e.in_group[0].name, 'users')
self.assertEquals(e.owned_by[0].login, 'syt')
- self.assertEquals(e.created_by, [])
+ self.assertEquals(e.created_by, ())
self.assertEquals(e.primary_email[0].address, 'Sylvain Thenault')
# email content should be indexed on the user
rset = self.execute('CWUser X WHERE X has_text "thenault"')
--- a/server/test/unittest_migractions.py Wed Oct 07 11:33:38 2009 +0200
+++ b/server/test/unittest_migractions.py Wed Oct 07 11:45:39 2009 +0200
@@ -306,9 +306,9 @@
'X ecrit_part PE, U in_group G, '
'PE require_permission P, P name "add_note", P require_group G')
self.assertEquals([et.name for et in eexpr.reverse_add_permission], ['Note'])
- self.assertEquals(eexpr.reverse_read_permission, [])
- self.assertEquals(eexpr.reverse_delete_permission, [])
- self.assertEquals(eexpr.reverse_update_permission, [])
+ self.assertEquals(eexpr.reverse_read_permission, ())
+ self.assertEquals(eexpr.reverse_delete_permission, ())
+ self.assertEquals(eexpr.reverse_update_permission, ())
# no more rqlexpr to delete and add para attribute
self.failIf(self._rrqlexpr_rset('add', 'para'))
self.failIf(self._rrqlexpr_rset('delete', 'para'))
@@ -318,8 +318,8 @@
'O require_permission P, P name "add_note", '
'U in_group G, P require_group G')
self.assertEquals([rt.name for rt in rexpr.reverse_add_permission], ['ecrit_par'])
- self.assertEquals(rexpr.reverse_read_permission, [])
- self.assertEquals(rexpr.reverse_delete_permission, [])
+ self.assertEquals(rexpr.reverse_read_permission, ())
+ self.assertEquals(rexpr.reverse_delete_permission, ())
# no more rqlexpr to delete and add travaille relation
self.failIf(self._rrqlexpr_rset('add', 'travaille'))
self.failIf(self._rrqlexpr_rset('delete', 'travaille'))
--- a/server/test/unittest_msplanner.py Wed Oct 07 11:33:38 2009 +0200
+++ b/server/test/unittest_msplanner.py Wed Oct 07 11:45:39 2009 +0200
@@ -682,7 +682,7 @@
def test_3sources_ambigous(self):
- self._test('Any X,T WHERE X owned_by U, U login "syt", X title T',
+ self._test('Any X,T WHERE X owned_by U, U login "syt", X title T, X is IN(Bookmark, Card, EmailThread)',
[('FetchStep', [('Any X,T WHERE X title T, X is Card', [{'X': 'Card', 'T': 'String'}])],
[self.cards, self.system], None,
{'T': 'table0.C1', 'X': 'table0.C0', 'X.title': 'table0.C1'}, []),
@@ -1275,7 +1275,7 @@
None, None, [self.system], {}, [])])
def test_has_text_3(self):
- self._test('Any X WHERE X has_text "toto", X title "zoubidou"',
+ self._test('Any X WHERE X has_text "toto", X title "zoubidou", X is IN (Card, EmailThread)',
[('FetchStep', [(u'Any X WHERE X title "zoubidou", X is Card',
[{'X': 'Card'}])],
[self.cards, self.system], None, {'X': 'table0.C0'}, []),
@@ -1299,7 +1299,7 @@
])
def test_ambigous_sort_func(self):
- self._test('Any X ORDERBY DUMB_SORT(RF) WHERE X title RF',
+ self._test('Any X ORDERBY DUMB_SORT(RF) WHERE X title RF, X is IN (Bookmark, Card, EmailThread)',
[('AggrStep', 'Any X ORDERBY DUMB_SORT(RF)',
None, None, 'table0', None,
[('FetchStep', [('Any X,RF WHERE X title RF, X is Card',
--- a/server/test/unittest_querier.py Wed Oct 07 11:33:38 2009 +0200
+++ b/server/test/unittest_querier.py Wed Oct 07 11:45:39 2009 +0200
@@ -219,7 +219,7 @@
self.assertIsInstance(rset[0][0], (int, long))
def test_bytes_storage(self):
- feid = self.execute('INSERT File X: X name "foo.pdf", X data_format "text/plain", X data %(data)s',
+ feid = self.execute('INSERT File X: X data_name "foo.pdf", X data_format "text/plain", X data %(data)s',
{'data': Binary("xxx")})[0][0]
fdata = self.execute('Any D WHERE X data D, X eid %(x)s', {'x': feid}, 'x')[0][0]
self.assertIsInstance(fdata, Binary)
@@ -460,7 +460,7 @@
self.assertListEquals(rset.rows,
[[u'description_format', 13],
[u'description', 14],
- [u'name', 16],
+ [u'name', 14],
[u'created_by', 38],
[u'creation_date', 38],
[u'cwuri', 38],
--- a/server/test/unittest_rql2sql.py Wed Oct 07 11:33:38 2009 +0200
+++ b/server/test/unittest_rql2sql.py Wed Oct 07 11:45:39 2009 +0200
@@ -336,54 +336,15 @@
FROM cw_CWUser AS X LEFT OUTER JOIN cw_CWUser AS Y ON (X.cw_eid=Y.cw_eid)
WHERE X.cw_login=admin'''),
- ('Any XN ORDERBY XN WHERE X name XN',
+ ('Any XN ORDERBY XN WHERE X name XN, X is IN (Basket,Folder,Tag)',
'''SELECT X.cw_name
-FROM cw_BaseTransition AS X
-UNION ALL
-SELECT X.cw_name
FROM cw_Basket AS X
UNION ALL
SELECT X.cw_name
-FROM cw_CWCache AS X
-UNION ALL
-SELECT X.cw_name
-FROM cw_CWConstraintType AS X
-UNION ALL
-SELECT X.cw_name
-FROM cw_CWEType AS X
-UNION ALL
-SELECT X.cw_name
-FROM cw_CWGroup AS X
-UNION ALL
-SELECT X.cw_name
-FROM cw_CWPermission AS X
-UNION ALL
-SELECT X.cw_name
-FROM cw_CWRType AS X
-UNION ALL
-SELECT X.cw_name
-FROM cw_File AS X
-UNION ALL
-SELECT X.cw_name
FROM cw_Folder AS X
UNION ALL
SELECT X.cw_name
-FROM cw_Image AS X
-UNION ALL
-SELECT X.cw_name
-FROM cw_State AS X
-UNION ALL
-SELECT X.cw_name
FROM cw_Tag AS X
-UNION ALL
-SELECT X.cw_name
-FROM cw_Transition AS X
-UNION ALL
-SELECT X.cw_name
-FROM cw_Workflow AS X
-UNION ALL
-SELECT X.cw_name
-FROM cw_WorkflowTransition AS X
ORDER BY 1'''),
# DISTINCT, can use relation under exists scope as principal
@@ -468,61 +429,22 @@
FROM cw_CWRType AS X, cw_RQLExpression AS Y
WHERE X.cw_name=CWGroup AND Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=X.cw_eid AND rel_read_permission0.eid_to=Y.cw_eid)'''),
- ('Any MAX(X)+MIN(X), N GROUPBY N WHERE X name N;',
+ ('Any MAX(X)+MIN(X), N GROUPBY N WHERE X name N, X is IN (Basket, Folder, Tag);',
'''SELECT (MAX(T1.C0) + MIN(T1.C0)), T1.C1 FROM (SELECT X.cw_eid AS C0, X.cw_name AS C1
-FROM cw_BaseTransition AS X
-UNION ALL
-SELECT X.cw_eid AS C0, X.cw_name AS C1
FROM cw_Basket AS X
UNION ALL
SELECT X.cw_eid AS C0, X.cw_name AS C1
-FROM cw_CWCache AS X
-UNION ALL
-SELECT X.cw_eid AS C0, X.cw_name AS C1
-FROM cw_CWConstraintType AS X
-UNION ALL
-SELECT X.cw_eid AS C0, X.cw_name AS C1
-FROM cw_CWEType AS X
-UNION ALL
-SELECT X.cw_eid AS C0, X.cw_name AS C1
-FROM cw_CWGroup AS X
-UNION ALL
-SELECT X.cw_eid AS C0, X.cw_name AS C1
-FROM cw_CWPermission AS X
-UNION ALL
-SELECT X.cw_eid AS C0, X.cw_name AS C1
-FROM cw_CWRType AS X
-UNION ALL
-SELECT X.cw_eid AS C0, X.cw_name AS C1
-FROM cw_File AS X
-UNION ALL
-SELECT X.cw_eid AS C0, X.cw_name AS C1
FROM cw_Folder AS X
UNION ALL
SELECT X.cw_eid AS C0, X.cw_name AS C1
-FROM cw_Image AS X
-UNION ALL
-SELECT X.cw_eid AS C0, X.cw_name AS C1
-FROM cw_State AS X
-UNION ALL
-SELECT X.cw_eid AS C0, X.cw_name AS C1
-FROM cw_Tag AS X
-UNION ALL
-SELECT X.cw_eid AS C0, X.cw_name AS C1
-FROM cw_Transition AS X
-UNION ALL
-SELECT X.cw_eid AS C0, X.cw_name AS C1
-FROM cw_Workflow AS X
-UNION ALL
-SELECT X.cw_eid AS C0, X.cw_name AS C1
-FROM cw_WorkflowTransition AS X) AS T1
+FROM cw_Tag AS X) AS T1
GROUP BY T1.C1'''),
- ('Any MAX(X)+MIN(LENGTH(D)), N GROUPBY N ORDERBY 1, N, DF WHERE X name N, X data D, X data_format DF;',
- '''SELECT (MAX(T1.C1) + MIN(LENGTH(T1.C0))), T1.C2 FROM (SELECT X.cw_data AS C0, X.cw_eid AS C1, X.cw_name AS C2, X.cw_data_format AS C3
+ ('Any MAX(X)+MIN(LENGTH(D)), N GROUPBY N ORDERBY 1, N, DF WHERE X data_name N, X data D, X data_format DF;',
+ '''SELECT (MAX(T1.C1) + MIN(LENGTH(T1.C0))), T1.C2 FROM (SELECT X.cw_data AS C0, X.cw_eid AS C1, X.cw_data_name AS C2, X.cw_data_format AS C3
FROM cw_File AS X
UNION ALL
-SELECT X.cw_data AS C0, X.cw_eid AS C1, X.cw_name AS C2, X.cw_data_format AS C3
+SELECT X.cw_data AS C0, X.cw_eid AS C1, X.cw_data_name AS C2, X.cw_data_format AS C3
FROM cw_Image AS X) AS T1
GROUP BY T1.C2
ORDER BY 1,2,T1.C3'''),
@@ -532,11 +454,11 @@
FROM cw_Affaire AS A
ORDER BY 2) AS T1'''),
- ('DISTINCT Any MAX(X)+MIN(LENGTH(D)), N GROUPBY N ORDERBY 2, DF WHERE X name N, X data D, X data_format DF;',
- '''SELECT T1.C0,T1.C1 FROM (SELECT DISTINCT (MAX(T1.C1) + MIN(LENGTH(T1.C0))) AS C0, T1.C2 AS C1, T1.C3 AS C2 FROM (SELECT DISTINCT X.cw_data AS C0, X.cw_eid AS C1, X.cw_name AS C2, X.cw_data_format AS C3
+ ('DISTINCT Any MAX(X)+MIN(LENGTH(D)), N GROUPBY N ORDERBY 2, DF WHERE X data_name N, X data D, X data_format DF;',
+ '''SELECT T1.C0,T1.C1 FROM (SELECT DISTINCT (MAX(T1.C1) + MIN(LENGTH(T1.C0))) AS C0, T1.C2 AS C1, T1.C3 AS C2 FROM (SELECT DISTINCT X.cw_data AS C0, X.cw_eid AS C1, X.cw_data_name AS C2, X.cw_data_format AS C3
FROM cw_File AS X
UNION
-SELECT DISTINCT X.cw_data AS C0, X.cw_eid AS C1, X.cw_name AS C2, X.cw_data_format AS C3
+SELECT DISTINCT X.cw_data AS C0, X.cw_eid AS C1, X.cw_data_name AS C2, X.cw_data_format AS C3
FROM cw_Image AS X) AS T1
GROUP BY T1.C2,T1.C3
ORDER BY 2,3) AS T1
@@ -1408,16 +1330,12 @@
FROM appears AS appears0, entities AS X
WHERE appears0.words @@ to_tsquery('default', 'hip&hop&momo') AND appears0.uid=X.eid AND X.type='Personne'"""),
- ('Any X WHERE X has_text "toto tata", X name "tutu", X is IN (Basket,File,Folder)',
+ ('Any X WHERE X has_text "toto tata", X name "tutu", X is IN (Basket,Folder)',
"""SELECT X.cw_eid
FROM appears AS appears0, cw_Basket AS X
WHERE appears0.words @@ to_tsquery('default', 'toto&tata') AND appears0.uid=X.cw_eid AND X.cw_name=tutu
UNION ALL
SELECT X.cw_eid
-FROM appears AS appears0, cw_File AS X
-WHERE appears0.words @@ to_tsquery('default', 'toto&tata') AND appears0.uid=X.cw_eid AND X.cw_name=tutu
-UNION ALL
-SELECT X.cw_eid
FROM appears AS appears0, cw_Folder AS X
WHERE appears0.words @@ to_tsquery('default', 'toto&tata') AND appears0.uid=X.cw_eid AND X.cw_name=tutu
"""),
@@ -1557,16 +1475,12 @@
FROM appears AS appears0, entities AS X
WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=X.eid AND X.type='Personne'"""),
- ('Any X WHERE X has_text "toto tata", X name "tutu", X is IN (Basket,File,Folder)',
+ ('Any X WHERE X has_text "toto tata", X name "tutu", X is IN (Basket,Folder)',
"""SELECT X.cw_eid
FROM appears AS appears0, cw_Basket AS X
WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=X.cw_eid AND X.cw_name=tutu
UNION ALL
SELECT X.cw_eid
-FROM appears AS appears0, cw_File AS X
-WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=X.cw_eid AND X.cw_name=tutu
-UNION ALL
-SELECT X.cw_eid
FROM appears AS appears0, cw_Folder AS X
WHERE appears0.word_id IN (SELECT word_id FROM word WHERE word in ('toto', 'tata')) AND appears0.uid=X.cw_eid AND X.cw_name=tutu
"""),
@@ -1618,16 +1532,12 @@
"""SELECT X.eid
FROM appears AS appears0, entities AS X
WHERE MATCH (appears0.words) AGAINST ('hip hop momo' IN BOOLEAN MODE) AND appears0.uid=X.eid AND X.type='Personne'"""),
- ('Any X WHERE X has_text "toto tata", X name "tutu", X is IN (Basket,File,Folder)',
+ ('Any X WHERE X has_text "toto tata", X name "tutu", X is IN (Basket,Folder)',
"""SELECT X.cw_eid
FROM appears AS appears0, cw_Basket AS X
WHERE MATCH (appears0.words) AGAINST ('toto tata' IN BOOLEAN MODE) AND appears0.uid=X.cw_eid AND X.cw_name=tutu
UNION ALL
SELECT X.cw_eid
-FROM appears AS appears0, cw_File AS X
-WHERE MATCH (appears0.words) AGAINST ('toto tata' IN BOOLEAN MODE) AND appears0.uid=X.cw_eid AND X.cw_name=tutu
-UNION ALL
-SELECT X.cw_eid
FROM appears AS appears0, cw_Folder AS X
WHERE MATCH (appears0.words) AGAINST ('toto tata' IN BOOLEAN MODE) AND appears0.uid=X.cw_eid AND X.cw_name=tutu
""")
--- a/server/test/unittest_ssplanner.py Wed Oct 07 11:33:38 2009 +0200
+++ b/server/test/unittest_ssplanner.py Wed Oct 07 11:45:39 2009 +0200
@@ -25,19 +25,19 @@
BasePlannerTC.tearDown(self)
def test_ordered_ambigous_sol(self):
- self._test('Any XN ORDERBY XN WHERE X name XN, X is IN (Basket, File, Folder)',
- [('OneFetchStep', [('Any XN ORDERBY XN WHERE X name XN, X is IN(Basket, File, Folder)',
+ self._test('Any XN ORDERBY XN WHERE X name XN, X is IN (Basket, State, Folder)',
+ [('OneFetchStep', [('Any XN ORDERBY XN WHERE X name XN, X is IN(Basket, State, Folder)',
[{'X': 'Basket', 'XN': 'String'},
- {'X': 'File', 'XN': 'String'},
+ {'X': 'State', 'XN': 'String'},
{'X': 'Folder', 'XN': 'String'}])],
None, None,
[self.system], None, [])])
def test_groupeded_ambigous_sol(self):
- self._test('Any XN,COUNT(X) GROUPBY XN WHERE X name XN, X is IN (Basket, File, Folder)',
- [('OneFetchStep', [('Any XN,COUNT(X) GROUPBY XN WHERE X name XN, X is IN(Basket, File, Folder)',
+ self._test('Any XN,COUNT(X) GROUPBY XN WHERE X name XN, X is IN (Basket, State, Folder)',
+ [('OneFetchStep', [('Any XN,COUNT(X) GROUPBY XN WHERE X name XN, X is IN(Basket, State, Folder)',
[{'X': 'Basket', 'XN': 'String'},
- {'X': 'File', 'XN': 'String'},
+ {'X': 'State', 'XN': 'String'},
{'X': 'Folder', 'XN': 'String'}])],
None, None,
[self.system], None, [])])
--- a/test/unittest_entity.py Wed Oct 07 11:33:38 2009 +0200
+++ b/test/unittest_entity.py Wed Oct 07 11:45:39 2009 +0200
@@ -314,11 +314,11 @@
def test_printable_value_bytes(self):
e = self.add_entity('File', data=Binary('lambda x: 1'), data_format=u'text/x-python',
- data_encoding=u'ascii', name=u'toto.py')
+ data_encoding=u'ascii', data_name=u'toto.py')
from cubicweb.common import mttransforms
if mttransforms.HAS_PYGMENTS_TRANSFORMS:
self.assertEquals(e.printable_value('data'),
- '''<div class="highlight"><pre><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="mf">1</span>
+ '''<div class="highlight"><pre><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="mi">1</span>
</pre></div>
''')
else:
@@ -329,7 +329,7 @@
''')
e = self.add_entity('File', data=Binary('*héhéhé*'), data_format=u'text/rest',
- data_encoding=u'utf-8', name=u'toto.txt')
+ data_encoding=u'utf-8', data_name=u'toto.txt')
self.assertEquals(e.printable_value('data'),
u'<p><em>héhéhé</em></p>\n')
@@ -356,6 +356,21 @@
e['content'] = u'C'est un exemple sérieux'
self.assertEquals(tidy(e.printable_value('content')),
u"C'est un exemple sérieux")
+ # make sure valid xhtml is left untouched
+ e['content'] = u'<div>R&D<br/></div>'
+ self.assertEquals(e.printable_value('content'), e['content'])
+ e['content'] = u'<div>été</div>'
+ self.assertEquals(e.printable_value('content'), e['content'])
+ e['content'] = u'été'
+ self.assertEquals(e.printable_value('content'), e['content'])
+ e['content'] = u'hop\r\nhop\nhip\rmomo'
+ self.assertEquals(e.printable_value('content'), u'hop\nhop\nhip\nmomo')
+
+ def test_printable_value_bad_html_ms(self):
+ self.skip('fix soup2xhtml to handle this test')
+ e = self.add_entity('Card', title=u'bad html', content=u'<div>R&D<br>',
+ content_format=u'text/html')
+ tidy = lambda x: x.replace('\n', '')
e['content'] = u'<div x:foo="bar">ms orifice produces weird html</div>'
self.assertEquals(tidy(e.printable_value('content')),
u'<div>ms orifice produces weird html</div>')
@@ -368,25 +383,17 @@
'char_encoding' : 'utf8'})).decode('utf-8').strip()
self.assertEquals(tidy(e.printable_value('content')),
u'<div>ms orifice produces weird html</div>')
- # make sure valid xhtml is left untouched
- e['content'] = u'<div>R&D<br/></div>'
- self.assertEquals(e.printable_value('content'), e['content'])
- e['content'] = u'<div>été</div>'
- self.assertEquals(e.printable_value('content'), e['content'])
- e['content'] = u'été'
- self.assertEquals(e.printable_value('content'), e['content'])
- e['content'] = u'hop\r\nhop\nhip\rmomo'
- self.assertEquals(e.printable_value('content'), u'hop\nhop\nhip\nmomo')
def test_fulltextindex(self):
e = self.etype_instance('File')
- e['name'] = 'an html file'
e['description'] = 'du <em>html</em>'
e['description_format'] = 'text/html'
e['data'] = Binary('some <em>data</em>')
+ e['data_name'] = 'an html file'
e['data_format'] = 'text/html'
e['data_encoding'] = 'ascii'
+ e.req.transaction_data = {} # XXX req should be a session
self.assertEquals(set(e.get_words()),
set(['an', 'html', 'file', 'du', 'html', 'some', 'data']))
@@ -409,7 +416,7 @@
self.failUnless(trinfo.relation_cached('from_state', 'subject'))
self.failUnless(trinfo.relation_cached('to_state', 'subject'))
self.failUnless(trinfo.relation_cached('wf_info_for', 'subject'))
- self.assertEquals(trinfo.by_transition, [])
+ self.assertEquals(trinfo.by_transition, ())
def test_request_cache(self):
req = self.request()
--- a/test/unittest_rset.py Wed Oct 07 11:33:38 2009 +0200
+++ b/test/unittest_rset.py Wed Oct 07 11:45:39 2009 +0200
@@ -287,7 +287,7 @@
e = rset.get_entity(0, 0)
# if any of the assertion below fails with a KeyError, the relation is not cached
# related entities should be an empty list
- self.assertEquals(e.related_cache('primary_email', 'subject', True), [])
+ self.assertEquals(e.related_cache('primary_email', 'subject', True), ())
# related rset should be an empty rset
cached = e.related_cache('primary_email', 'subject', False)
self.assertIsInstance(cached, ResultSet)
--- a/test/unittest_schema.py Wed Oct 07 11:33:38 2009 +0200
+++ b/test/unittest_schema.py Wed Oct 07 11:45:39 2009 +0200
@@ -166,7 +166,7 @@
'composite', 'condition', 'connait', 'constrained_by', 'content',
'content_format', 'created_by', 'creation_date', 'cstrtype', 'custom_workflow', 'cwuri',
- 'data', 'data_encoding', 'data_format', 'default_workflow', 'defaultval', 'delete_permission',
+ 'data', 'data_encoding', 'data_format', 'data_name', 'default_workflow', 'defaultval', 'delete_permission',
'description', 'description_format', 'destination_state',
'ecrit_par', 'eid', 'evaluee', 'expression', 'exprtype',
--- a/web/test/unittest_views_basecontrollers.py Wed Oct 07 11:33:38 2009 +0200
+++ b/web/test/unittest_views_basecontrollers.py Wed Oct 07 11:45:39 2009 +0200
@@ -203,7 +203,7 @@
def test_interval_bound_constraint_success(self):
- feid = self.execute('INSERT File X: X name "toto.txt", X data %(data)s',
+ feid = self.execute('INSERT File X: X data_name "toto.txt", X data %(data)s',
{'data': Binary('yo')})[0][0]
self.req.form = {'eid': ['X'],
'__type:X': 'Salesterm',
--- a/web/test/unittest_views_editforms.py Wed Oct 07 11:33:38 2009 +0200
+++ b/web/test/unittest_views_editforms.py Wed Oct 07 11:45:39 2009 +0200
@@ -35,7 +35,6 @@
[('login', 'subject'),
('upassword', 'subject'),
('in_group', 'subject'),
- ('in_state', 'subject'),
('eid', 'subject'),
])
self.assertListEquals(rbc(e, 'secondary'),
@@ -60,6 +59,7 @@
# owned_by is defined both as subject and object relations on CWUser
self.assertListEquals(rbc(e, 'generated'),
[('use_email', 'subject'),
+ ('in_state', 'subject'),
('has_text', 'subject'),
('identity', 'subject'),
('is', 'subject'),
@@ -153,12 +153,12 @@
geid = self.execute('CWGroup X LIMIT 1')[0][0]
rset = self.execute('CWUser X LIMIT 1')
self.view('inline-edition', rset, row=0, col=0, rtype='in_group',
- peid=geid, role='subject', template=None, i18nctx='').source
+ peid=geid, role='object', template=None, i18nctx='').source
def test_automatic_inline_creation_formview(self):
geid = self.execute('CWGroup X LIMIT 1')[0][0]
self.view('inline-creation', None, etype='CWUser', rtype='in_group',
- peid=geid, template=None, i18nctx='', role='subject').source
+ peid=geid, template=None, i18nctx='', role='object').source
if __name__ == '__main__':
--- a/web/test/unittest_viewselector.py Wed Oct 07 11:33:38 2009 +0200
+++ b/web/test/unittest_viewselector.py Wed Oct 07 11:45:39 2009 +0200
@@ -27,6 +27,9 @@
('schema', schema.ViewSchemaAction),
('siteinfo', actions.SiteInfoAction),
]
+FOOTERACTIONS = [('changelog', wdoc.ChangeLogAction),
+ ('about', wdoc.AboutAction),
+ ('poweredby', actions.PoweredByAction)]
class ViewSelectorTC(EnvBasedTC):
@@ -220,6 +223,7 @@
self.assertDictEqual(self.pactions(req, None),
{'useractions': USERACTIONS,
'siteactions': SITEACTIONS,
+ 'footer': FOOTERACTIONS,
})
def test_possible_actions_no_entity(self):
@@ -227,6 +231,7 @@
self.assertDictEqual(self.pactions(req, rset),
{'useractions': USERACTIONS,
'siteactions': SITEACTIONS,
+ 'footer': FOOTERACTIONS,
})
def test_possible_actions_same_type_entities(self):
@@ -234,6 +239,7 @@
self.assertDictEqual(self.pactions(req, rset),
{'useractions': USERACTIONS,
'siteactions': SITEACTIONS,
+ 'footer': FOOTERACTIONS,
'mainactions': [('muledit', actions.MultipleEditAction)],
'moreactions': [('delete', actions.DeleteAction),
('addentity', actions.AddNewAction)],
@@ -244,6 +250,7 @@
self.assertDictEqual(self.pactions(req, rset),
{'useractions': USERACTIONS,
'siteactions': SITEACTIONS,
+ 'footer': FOOTERACTIONS,
'moreactions': [('delete', actions.DeleteAction)],
})
@@ -251,13 +258,16 @@
rset, req = self.env.get_rset_and_req('Any N, X WHERE X in_group Y, Y name N')
self.assertDictEqual(self.pactions(req, rset),
{'useractions': USERACTIONS,
- 'siteactions': SITEACTIONS})
+ 'siteactions': SITEACTIONS,
+ 'footer': FOOTERACTIONS,
+ })
def test_possible_actions_eetype_cwuser_entity(self):
rset, req = self.env.get_rset_and_req('CWEType X WHERE X name "CWUser"')
self.assertDictEqual(self.pactions(req, rset),
{'useractions': USERACTIONS,
'siteactions': SITEACTIONS,
+ 'footer': FOOTERACTIONS,
'mainactions': [('edit', actions.ModifyAction)],
'moreactions': [('managepermission', actions.ManagePermissionsAction),
('addrelated', actions.AddRelatedActions),
@@ -365,22 +375,22 @@
tableview.TableView)
def test_interface_selector(self):
- image = self.add_entity('Image', name=u'bim.png', data=Binary('bim'))
+ image = self.add_entity('Image', data_name=u'bim.png', data=Binary('bim'))
# image primary view priority
- rset, req = self.env.get_rset_and_req('Image X WHERE X name "bim.png"')
+ rset, req = self.env.get_rset_and_req('Image X WHERE X data_name "bim.png"')
self.assertIsInstance(self.vreg['views'].select('primary', req, rset=rset),
idownloadable.IDownloadablePrimaryView)
def test_score_entity_selector(self):
- image = self.add_entity('Image', name=u'bim.png', data=Binary('bim'))
+ image = self.add_entity('Image', data_name=u'bim.png', data=Binary('bim'))
# image primary view priority
- rset, req = self.env.get_rset_and_req('Image X WHERE X name "bim.png"')
+ rset, req = self.env.get_rset_and_req('Image X WHERE X data_name "bim.png"')
self.assertIsInstance(self.vreg['views'].select('image', req, rset=rset),
idownloadable.ImageView)
- fileobj = self.add_entity('File', name=u'bim.txt', data=Binary('bim'))
+ fileobj = self.add_entity('File', data_name=u'bim.txt', data=Binary('bim'))
# image primary view priority
- rset, req = self.env.get_rset_and_req('File X WHERE X name "bim.txt"')
+ rset, req = self.env.get_rset_and_req('File X WHERE X data_name "bim.txt"')
self.assertRaises(NoSelectableObject, self.vreg['views'].select, 'image', req, rset=rset)
@@ -447,6 +457,7 @@
self.assertDictEqual(self.pactions(req, rset),
{'useractions': USERACTIONS,
'siteactions': SITEACTIONS,
+ 'footer': FOOTERACTIONS,
'mainactions': [('edit', actions.ModifyAction)],
'moreactions': [('managepermission', actions.ManagePermissionsAction),
('addrelated', actions.AddRelatedActions),
@@ -459,6 +470,7 @@
self.assertDictEqual(self.pactions(req, rset),
{'useractions': USERACTIONS,
'siteactions': SITEACTIONS,
+ 'footer': FOOTERACTIONS,
'mainactions': [('edit', actions.ModifyAction)],
'moreactions': [('managepermission', actions.ManagePermissionsAction),
('addrelated', actions.AddRelatedActions),