88
99
1010class TestAbstractUrl (TransactionCase , FakeModelLoader ):
11- @classmethod
12- def setUpClass (cls ):
13- super ().setUpClass ()
14- cls .loader = FakeModelLoader (cls .env , cls .__module__ )
15- cls .loader .backup_registry ()
11+ def setUp (self ):
12+ super ().setUp ()
13+ self .loader = FakeModelLoader (self .env , self .__module__ )
14+ self .loader .backup_registry ()
1615 from .models import FakeCateg , FakeProduct
1716
18- cls .loader .update_registry ([FakeProduct , FakeCateg ])
17+ self .loader .update_registry ([FakeProduct , FakeCateg ])
1918
20- cls .lang_en = cls .env .ref ("base.lang_en" )
21- cls .lang_fr = cls .env .ref ("base.lang_fr" )
22- cls .lang_fr .active = True
23- cls .product = (
24- cls .env ["fake.product" ]
19+ self .lang_en = self .env .ref ("base.lang_en" )
20+ self .lang_fr = self .env .ref ("base.lang_fr" )
21+ self .lang_fr .active = True
22+ self .product = (
23+ self .env ["fake.product" ]
2524 .with_context (lang = "en_US" )
2625 .create ({"name" : "My Product" })
2726 )
28- cls .product .with_context (lang = "fr_FR" ).name = "Mon Produit"
27+ self .product .with_context (lang = "fr_FR" ).name = "Mon Produit"
2928
3029 def _expect_url_for_lang (self , lang , url_key ):
3130 self .assertEqual (self .product ._get_main_url ("global" , lang ).key , url_key )
3231
33- @classmethod
34- def tearDownClass (cls ):
35- cls .loader .restore_registry ()
36- super ().tearDownClass ()
32+ def tearDown (self ):
33+ self .loader .restore_registry ()
34+ super ().tearDown ()
3735
3836 def test_update_url_key (self ):
3937 self .product ._update_url_key ("global" , "en_US" )
@@ -123,7 +121,8 @@ def test_write_inactive(self):
123121 mocked_redirect .assert_called_once ()
124122
125123 def test_update_twice_write_once (self ):
126- """"
124+ (
125+ """"
127126 When we update twice the same record, the write method should be called
128127 only once. This is important because for example, by default, in
129128 shopinvader_search_engine_update, when the method write is called,
@@ -133,7 +132,9 @@ def test_update_twice_write_once(self):
133132 times the _update_url_key method. The first time, if every time the
134133 method make a write on the record, the record will end up with the
135134 state to_recompute.
136- """ ""
135+ """
136+ ""
137+ )
137138
138139 # we mock the write method to check the number of call but we want the
139140 # method to be executed
0 commit comments