author | Julien Jehannet <julien.jehannet@logilab.fr> |
Thu, 22 Apr 2010 17:04:51 +0200 | |
changeset 5373 | 24a873060692 |
parent 4715 | d3f87ee74fe4 |
child 5421 | 8167de96c523 |
permissions | -rw-r--r-- |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1900
diff
changeset
|
1 |
""" |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1900
diff
changeset
|
2 |
|
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1900
diff
changeset
|
3 |
:organization: Logilab |
4212
ab6573088b4a
update copyright: welcome 2010
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3168
diff
changeset
|
4 |
:copyright: 2001-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1900
diff
changeset
|
5 |
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1900
diff
changeset
|
6 |
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1900
diff
changeset
|
7 |
""" |
0 | 8 |
from logilab.common.testlib import TestCase, unittest_main |
9 |
||
2773
b2530e3e0afb
[testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2439
diff
changeset
|
10 |
from cubicweb.devtools.testlib import CubicWebTC |
b2530e3e0afb
[testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2439
diff
changeset
|
11 |
from cubicweb.devtools.fake import FakeRequest |
0 | 12 |
|
13 |
from cubicweb.web.views.urlrewrite import SimpleReqRewriter, SchemaBasedRewriter, rgx, rgx_action |
|
14 |
||
15 |
||
3465
01616e5fa590
[tests] make unittest_urlrewrite pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3185
diff
changeset
|
16 |
class UrlRewriteTC(CubicWebTC): |
0 | 17 |
|
18 |
def test_auto_extend_rules(self): |
|
19 |
class Rewriter(SimpleReqRewriter): |
|
20 |
rules = [ |
|
21 |
('foo', dict(rql='Foo F')), |
|
22 |
('/index', dict(vid='index2')), |
|
23 |
] |
|
24 |
rules = [] |
|
25 |
for pattern, values in Rewriter.rules: |
|
26 |
if hasattr(pattern, 'pattern'): |
|
27 |
pattern = pattern.pattern |
|
28 |
rules.append((pattern, values)) |
|
29 |
self.assertListEquals(rules, [ |
|
30 |
('foo' , dict(rql='Foo F')), |
|
31 |
('/index' , dict(vid='index2')), |
|
2780
ad1dfc3855b0
B web/tests back to green
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2439
diff
changeset
|
32 |
('/_', dict(vid='manage')), |
ad1dfc3855b0
B web/tests back to green
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2439
diff
changeset
|
33 |
('/_registry', dict(vid='registry')), |
2439
77d8dd77acb3
[cleanup] fix tests
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
34 |
('/schema', dict(vid='schema')), |
1900
8dd4bb69c73d
[tests] fix test after eproperties got renamed to cwproperties
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1802
diff
changeset
|
35 |
('/myprefs', dict(vid='propertiesform')), |
8dd4bb69c73d
[tests] fix test after eproperties got renamed to cwproperties
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1802
diff
changeset
|
36 |
('/siteconfig', dict(vid='systempropertiesform')), |
2439
77d8dd77acb3
[cleanup] fix tests
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
37 |
('/siteinfo', dict(vid='info')), |
0 | 38 |
('/manage', dict(vid='manage')), |
2439
77d8dd77acb3
[cleanup] fix tests
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
39 |
('/notfound', dict(vid='404')), |
77d8dd77acb3
[cleanup] fix tests
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
40 |
('/error', dict(vid='error')), |
77d8dd77acb3
[cleanup] fix tests
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
41 |
('/sparql', dict(vid='sparql')), |
4715
d3f87ee74fe4
[test] fix test broken by arthur processinfo patch
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4390
diff
changeset
|
42 |
('/processinfo', dict(vid='processinfo')), |
4390 | 43 |
('/schema/([^/]+?)/?$', {'rql': r'Any X WHERE X is CWEType, X name "\1"', 'vid': 'primary'}), |
0 | 44 |
('/add/([^/]+?)/?$' , dict(vid='creation', etype=r'\1')), |
45 |
('/doc/images/(.+?)/?$', dict(fid='\\1', vid='wdocimages')), |
|
46 |
('/doc/?$', dict(fid='main', vid='wdoc')), |
|
47 |
('/doc/(.+?)/?$', dict(fid='\\1', vid='wdoc')), |
|
48 |
('/changelog/?$', dict(vid='changelog')), |
|
49 |
# now in SchemaBasedRewriter |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
50 |
#('/search/(.+)$', dict(rql=r'Any X WHERE X has_text "\1"')), |
0 | 51 |
]) |
52 |
||
53 |
||
54 |
def test_no_extend_rules(self): |
|
55 |
class Rewriter(SimpleReqRewriter): |
|
56 |
ignore_baseclass_rules = True |
|
57 |
rules = [ |
|
58 |
('foo', dict(rql='Foo F')), |
|
59 |
('/index', dict(vid='index2')), |
|
60 |
] |
|
61 |
self.assertListEquals(Rewriter.rules, [ |
|
62 |
('foo' , dict(rql='Foo F')), |
|
63 |
('/index' , dict(vid='index2')), |
|
64 |
]) |
|
65 |
||
66 |
def test_basic_transformation(self): |
|
67 |
"""test simple string-based rewrite""" |
|
68 |
req = FakeRequest() |
|
3465
01616e5fa590
[tests] make unittest_urlrewrite pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3185
diff
changeset
|
69 |
rewriter = SimpleReqRewriter(req) |
0 | 70 |
self.assertRaises(KeyError, rewriter.rewrite, req, '/view?vid=whatever') |
71 |
self.assertEquals(req.form, {}) |
|
72 |
rewriter.rewrite(req, '/index') |
|
73 |
self.assertEquals(req.form, {'vid' : "index"}) |
|
74 |
||
75 |
def test_regexp_transformation(self): |
|
76 |
"""test regexp-based rewrite""" |
|
77 |
req = FakeRequest() |
|
3465
01616e5fa590
[tests] make unittest_urlrewrite pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3185
diff
changeset
|
78 |
rewriter = SimpleReqRewriter(req) |
0 | 79 |
rewriter.rewrite(req, '/add/Task') |
80 |
self.assertEquals(req.form, {'vid' : "creation", 'etype' : "Task"}) |
|
81 |
req = FakeRequest() |
|
82 |
rewriter.rewrite(req, '/add/Task/') |
|
83 |
self.assertEquals(req.form, {'vid' : "creation", 'etype' : "Task"}) |
|
84 |
||
85 |
||
86 |
||
87 |
||
2773
b2530e3e0afb
[testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2439
diff
changeset
|
88 |
class RgxActionRewriteTC(CubicWebTC): |
0 | 89 |
|
90 |
def setup_database(self): |
|
91 |
self.p1 = self.create_user(u'user1') |
|
92 |
self.p1.set_attributes(firstname=u'joe', surname=u'Dalton') |
|
93 |
self.p2 = self.create_user(u'user2') |
|
94 |
self.p2.set_attributes(firstname=u'jack', surname=u'Dalton') |
|
95 |
||
96 |
def test_rgx_action_with_transforms(self): |
|
97 |
class TestSchemaBasedRewriter(SchemaBasedRewriter): |
|
98 |
rules = [ |
|
99 |
(rgx('/(?P<sn>\w+)/(?P<fn>\w+)'), rgx_action(r'Any X WHERE X surname %(sn)s, X firstname %(fn)s', |
|
100 |
argsgroups=('sn', 'fn'), |
|
101 |
transforms={'sn' : unicode.capitalize, |
|
102 |
'fn' : unicode.lower,})), |
|
103 |
] |
|
104 |
req = self.request() |
|
3465
01616e5fa590
[tests] make unittest_urlrewrite pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3185
diff
changeset
|
105 |
rewriter = TestSchemaBasedRewriter(req) |
0 | 106 |
pmid, rset = rewriter.rewrite(req, u'/DaLToN/JoE') |
107 |
self.assertEquals(len(rset), 1) |
|
108 |
self.assertEquals(rset[0][0], self.p1.eid) |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
109 |
|
3168
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
110 |
def test_inheritance_precedence(self): |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
111 |
RQL1 = 'Any C WHERE C is CWEType' |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
112 |
RQL2 = 'Any C WHERE C is CWUser' |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
113 |
|
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
114 |
class BaseRewriter(SchemaBasedRewriter): |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
115 |
rules = [ |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
116 |
(rgx('/collector(.*)'), |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
117 |
rgx_action(rql=RQL1, |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
118 |
form=dict(vid='baseindex')), |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
119 |
), |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
120 |
] |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
121 |
class Rewriter(BaseRewriter): |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
122 |
rules = [ |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
123 |
(rgx('/collector/something(/?)'), |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
124 |
rgx_action(rql=RQL2, |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
125 |
form=dict(vid='index')), |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
126 |
), |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
127 |
] |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
128 |
|
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
129 |
req = self.request() |
3465
01616e5fa590
[tests] make unittest_urlrewrite pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3185
diff
changeset
|
130 |
rewriter = Rewriter(req) |
3168
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
131 |
pmid, rset = rewriter.rewrite(req, '/collector') |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
132 |
self.assertEquals(rset.rql, RQL1) |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
133 |
self.assertEquals(req.form, {'vid' : "baseindex"}) |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
134 |
pmid, rset = rewriter.rewrite(req, '/collector/something') |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
135 |
self.assertEquals(rset.rql, RQL2) |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
136 |
self.assertEquals(req.form, {'vid' : "index"}) |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
137 |
pmid, rset = rewriter.rewrite(req, '/collector/something/') |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
138 |
self.assertEquals(req.form, {'vid' : "index"}) |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
139 |
self.assertEquals(rset.rql, RQL2) |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
140 |
pmid, rset = rewriter.rewrite(req, '/collector/somethingelse/') |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
141 |
self.assertEquals(rset.rql, RQL1) |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
142 |
self.assertEquals(req.form, {'vid' : "baseindex"}) |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
143 |
|
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
144 |
def test_inheritance_precedence_same_rgx(self): |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
145 |
RQL1 = 'Any C WHERE C is CWEType' |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
146 |
RQL2 = 'Any C WHERE C is CWUser' |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
147 |
|
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
148 |
class BaseRewriter(SchemaBasedRewriter): |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
149 |
rules = [ |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
150 |
(rgx('/collector(.*)'), |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
151 |
rgx_action(rql=RQL1, |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
152 |
form=dict(vid='baseindex')), |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
153 |
), |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
154 |
] |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
155 |
class Rewriter(BaseRewriter): |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
156 |
rules = [ |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
157 |
(rgx('/collector(.*)'), |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
158 |
rgx_action(rql=RQL2, |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
159 |
form=dict(vid='index')), |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
160 |
), |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
161 |
] |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
162 |
|
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
163 |
req = self.request() |
3465
01616e5fa590
[tests] make unittest_urlrewrite pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3185
diff
changeset
|
164 |
rewriter = Rewriter(req) |
3168
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
165 |
pmid, rset = rewriter.rewrite(req, '/collector') |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
166 |
self.assertEquals(rset.rql, RQL2) |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
167 |
self.assertEquals(req.form, {'vid' : "index"}) |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
168 |
pmid, rset = rewriter.rewrite(req, '/collector/something') |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
169 |
self.assertEquals(rset.rql, RQL2) |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
170 |
self.assertEquals(req.form, {'vid' : "index"}) |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
171 |
pmid, rset = rewriter.rewrite(req, '/collector/something/') |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
172 |
self.assertEquals(req.form, {'vid' : "index"}) |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
173 |
self.assertEquals(rset.rql, RQL2) |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
174 |
pmid, rset = rewriter.rewrite(req, '/collector/somethingelse/') |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
175 |
self.assertEquals(rset.rql, RQL2) |
1ecd1b6d6f1b
[tests] inheritance_precedence in url rewrite
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
2780
diff
changeset
|
176 |
self.assertEquals(req.form, {'vid' : "index"}) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
177 |
|
0 | 178 |
|
179 |
if __name__ == '__main__': |
|
180 |
unittest_main() |