@@ -80,25 +80,24 @@ def test_03_create_phone_with_valid_number_without_prefix(self):
8080 self .assertEqual (phone .phone_no , "09123456789" )
8181
8282 def test_04_create_phone_with_letters_in_number (self ):
83- phone = self .phone_model .create (
84- {
85- "partner_id" : self .registrant .id ,
86- "phone_no" : "09123A56789" ,
87- "country_id" : self .env .ref ("base.ph" ).id ,
88- }
89- )
83+ phone_vals = {
84+ "partner_id" : self .registrant .id ,
85+ "phone_no" : "09123A56789" ,
86+ "country_id" : self .env .ref ("base.ph" ).id ,
87+ }
9088 with self .assertRaises (ValidationError ) as cm :
91- phone ._onchange_phone_validation ()
89+ self .phone_model .create (phone_vals )
90+
9291 self .assertIn ("Phone number must not contain letters" , str (cm .exception ))
9392
9493 def test_05_create_phone_with_invalid_special_characters (self ):
95- phone = self .phone_model .create (
96- {
97- "partner_id" : self .registrant .id ,
98- "phone_no" : "09123$$456789" ,
99- "country_id" : self .env .ref ("base.ph" ).id ,
100- }
101- )
94+ phone_vals = {
95+ "partner_id" : self .registrant .id ,
96+ "phone_no" : "09123@456789" ,
97+ "country_id" : self .env .ref ("base.ph" ).id ,
98+ }
99+
102100 with self .assertRaises (ValidationError ) as cm :
103- phone ._onchange_phone_validation ()
101+ self .phone_model .create (phone_vals )
102+
104103 self .assertIn ("Phone number contains invalid special characters" , str (cm .exception ))
0 commit comments