use cw_set

authorSylvain Thénault <sylvain.thenault@logilab.fr>
changeset160c7f688739
branchdefault
phasepublic
hiddenno
parent revision#489ebcadad15 fix tests
child revision#70d38272e45a default is stable, #ab4e13a59de3 [views] Fix JavaScript paths in ``add_js`` calls.
files modified by this revision
test/unittest_wireit.py
# HG changeset patch
# User Sylvain Thénault <sylvain.thenault@logilab.fr>
# Date 1375185758 -7200
# Tue Jul 30 14:02:38 2013 +0200
# Node ID 160c7f6887395ee7f1a8ce3041957708a45644e3
# Parent 489ebcadad15a0dea23bfa86e0b1e69c1fd49dbf
use cw_set

diff --git a/test/unittest_wireit.py b/test/unittest_wireit.py
@@ -45,11 +45,11 @@
1 
2  class UpdateWiringLanguageHookTC(WiringTCMixin, CubicWebTC):
3 
4      def setup_database(self):
5          super(UpdateWiringLanguageHookTC, self).setup_database()
6 -        self.wl.set_attributes(json=self._json_content('wlan.json'))
7 +        self.wl.cw_set(json=self._json_content('wlan.json'))
8          ce = self.request().create_entity
9          self.wiring = ce('Wiring', json=self._json_content('wiring.json'),
10                           language=self.wl)
11          self.commit()
12 
@@ -59,29 +59,29 @@
13 
14      def test_valid(self):
15          'check a valid definition does not raise ValidationError'
16          new_def = loads(self.wiring.json)
17          new_def['toto'] = u'titi'
18 -        self.wiring.set_attributes(json=unicode(dumps(new_def)))
19 +        self.wiring.cw_set(json=unicode(dumps(new_def)))
20          self.commit()
21 
22      def test_invalid_module_list(self):
23          'remove a module used by the wiring def and check ValidationError'
24          wldef = loads(self.wl.json)
25          del wldef['modules'][0]
26          with self.assertRaises(ValidationError) as cm:
27 -            self.wl.set_attributes(json=unicode(dumps(wldef)))
28 +            self.wl.cw_set(json=unicode(dumps(wldef)))
29              self.commit()
30          self.rollback()
31          self.assertTrue('Invalid WiringLanguage change' in str(cm.exception))
32 
33      def test_invalid_module_definition(self):
34          'change a container def used by the wiring and check ValidationError'
35          wldef = loads(self.wl.json)
36          wldef['modules'][0]['container']['title'] = u'changed_title'
37          with self.assertRaises(ValidationError) as cm:
38 -            self.wl.set_attributes(json=unicode(dumps(wldef)))
39 +            self.wl.cw_set(json=unicode(dumps(wldef)))
40              self.commit()
41          self.rollback()
42          self.assertTrue('Invalid WiringLanguage change' in str(cm.exception))
43 
44  if __name__ == '__main__':