@@ -501,6 +501,20 @@ def test_required_vpn_template_corner_case(self):
501501 # {'__all__': ['VPN client with this Config and Vpn already exists.']}
502502 self .assertIsNotNone (vpn_client )
503503
504+ def test_regression_preventing_from_fixing_invalid_conf (self ):
505+ template = self ._create_template ()
506+ # create a template with an invalid configuration
507+ Template .objects .update (config = {'interfaces' : [{'name' : 'eth0' , 'type' : '' }]})
508+ # ensure the configuration raises ValidationError
509+ with self .assertRaises (NetjsonconfigValidationError ):
510+ template .refresh_from_db ()
511+ del template .backend_instance
512+ template .checksum
513+ del template .backend_instance
514+ template .config = {'interfaces' : [{'name' : 'eth0' , 'type' : 'ethernet' }]}
515+ template .full_clean ()
516+ template .save ()
517+
504518
505519class TestTemplateTransaction (
506520 TransactionTestMixin ,
@@ -734,18 +748,3 @@ def test_task_timeout(self, mocked_update_related_config_status):
734748 template .save ()
735749 mocked_error .assert_called_once ()
736750 mocked_update_related_config_status .assert_called_once ()
737-
738- def test_fixing_wrong_configuration (self ):
739- template = self ._create_template ()
740- # create a wrong configuration
741- Template .objects .update (config = {'interfaces' : [{'name' : 'eth0' , 'type' : '' }]})
742- # Ensure the configuration raises ValidationError
743- with self .assertRaises (NetjsonconfigValidationError ):
744- template .refresh_from_db ()
745- del template .backend_instance
746- template .checksum
747-
748- del template .backend_instance
749- template .config = {'interfaces' : [{'name' : 'eth0' , 'type' : 'ethernet' }]}
750- template .full_clean ()
751- template .save ()
0 commit comments