283 usergroups = [gname for gname, in |
283 usergroups = [gname for gname, in |
284 self.execute('Any N WHERE G name N, U in_group G, U eid %(u)s', {'u': user.eid})] |
284 self.execute('Any N WHERE G name N, U in_group G, U eid %(u)s', {'u': user.eid})] |
285 self.assertItemsEqual(usergroups, ['managers']) |
285 self.assertItemsEqual(usergroups, ['managers']) |
286 self.assertEqual(get_pending_deletes(req), []) |
286 self.assertEqual(get_pending_deletes(req), []) |
287 |
287 |
288 # def test_custom_attribute_handler(self): |
|
289 # def custom_login_edit(self, formparams, value, relations): |
|
290 # formparams['login'] = value.upper() |
|
291 # relations.append('X login %(login)s') |
|
292 # CWUser.custom_login_edit = custom_login_edit |
|
293 # try: |
|
294 # user = self.user() |
|
295 # eid = repr(user.eid) |
|
296 # req = self.request() |
|
297 # req.form = { |
|
298 # 'eid': eid, |
|
299 # '__type:'+eid: 'CWUser', |
|
300 # 'login:'+eid: u'foo', |
|
301 # } |
|
302 # path, params = self.expect_redirect_publish(req, 'edit') |
|
303 # rset = self.execute('Any L WHERE X eid %(x)s, X login L', {'x': user.eid}, 'x') |
|
304 # self.assertEqual(rset[0][0], 'FOO') |
|
305 # finally: |
|
306 # del CWUser.custom_login_edit |
|
307 |
|
308 def test_redirect_apply_button(self): |
288 def test_redirect_apply_button(self): |
309 redirectrql = rql_for_eid(4012) # whatever |
289 redirectrql = rql_for_eid(4012) # whatever |
310 req = self.request() |
290 req = self.request() |
311 req.form = { |
291 req.form = { |
312 'eid': 'A', '__maineid' : 'A', |
292 'eid': 'A', '__maineid' : 'A', |
321 } |
301 } |
322 path, params = self.expect_redirect_publish(req, 'edit') |
302 path, params = self.expect_redirect_publish(req, 'edit') |
323 self.failUnless(path.startswith('blogentry/')) |
303 self.failUnless(path.startswith('blogentry/')) |
324 eid = path.split('/')[1] |
304 eid = path.split('/')[1] |
325 self.assertEqual(params['vid'], 'edition') |
305 self.assertEqual(params['vid'], 'edition') |
326 self.assertNotEquals(int(eid), 4012) |
306 self.assertNotEqual(int(eid), 4012) |
327 self.assertEqual(params['__redirectrql'], redirectrql) |
307 self.assertEqual(params['__redirectrql'], redirectrql) |
328 self.assertEqual(params['__redirectvid'], 'primary') |
308 self.assertEqual(params['__redirectvid'], 'primary') |
329 self.assertEqual(params['__redirectparams'], 'toto=tutu&tata=titi') |
309 self.assertEqual(params['__redirectparams'], 'toto=tutu&tata=titi') |
330 |
310 |
331 def test_redirect_ok_button(self): |
311 def test_redirect_ok_button(self): |