File tree Expand file tree Collapse file tree
tests/unit/plugins/modules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,19 +14,13 @@ def setUp(self):
1414 'pyrfc' : MagicMock (),
1515 'pyrfc.Connection' : MagicMock ()
1616 }
17- self .patcher = patch .dict ('sys.modules' , self .pyrfc_mock )
18- self .patcher .start ()
17+ patcher = patch .dict ('sys.modules' , self .pyrfc_mock )
18+ patcher .start ()
19+ self .addCleanup (patcher .stop )
1920 super (TestSAPRfcModule , self ).setUp ()
2021 from ansible_collections .community .sap_libs .plugins .modules import sap_company
2122 self .module = sap_company
2223
23- def tearDown (self ):
24- self .patcher .stop ()
25- super (TestSAPRfcModule , self ).tearDown ()
26-
27- def define_rfc_connect (self , mocker ):
28- return mocker .patch (self .module .call_rfc_method )
29-
3024 def test_without_required_parameters (self ):
3125 """Failure must occurs when all parameters are missing"""
3226 with self .assertRaises (AnsibleFailJson ):
Original file line number Diff line number Diff line change @@ -15,19 +15,13 @@ def setUp(self):
1515 'suds.sudsobject' : MagicMock (),
1616 'suds' : MagicMock ()
1717 }
18- self .patcher = patch .dict ('sys.modules' , self .suds_mock )
19- self .patcher .start ()
18+ patcher = patch .dict ('sys.modules' , self .suds_mock )
19+ patcher .start ()
20+ self .addCleanup (patcher .stop )
2021 super (TestSapcontrolModule , self ).setUp ()
2122 from ansible_collections .community .sap_libs .plugins .modules import sap_control_exec
2223 self .module = sap_control_exec
2324
24- def tearDown (self ):
25- self .patcher .stop ()
26- super (TestSapcontrolModule , self ).tearDown ()
27-
28- def define_rfc_connect (self , mocker ):
29- return mocker .patch (self .module .call_rfc_method )
30-
3125 def test_without_required_parameters (self ):
3226 """Failure must occurs when all parameters are missing"""
3327 with self .assertRaises (AnsibleFailJson ):
Original file line number Diff line number Diff line change @@ -23,16 +23,13 @@ def setUp(self):
2323 'pyrfc' : MagicMock (),
2424 'pyrfc.Connection' : MagicMock ()
2525 }
26- self .patcher = patch .dict ('sys.modules' , self .pyrfc_mock )
27- self .patcher .start ()
26+ patcher = patch .dict ('sys.modules' , self .pyrfc_mock )
27+ patcher .start ()
28+ self .addCleanup (patcher .stop )
2829 super (TestSAPRfcModule , self ).setUp ()
2930 from ansible_collections .community .sap_libs .plugins .modules import sap_pyrfc
3031 self .module = sap_pyrfc
3132
32- def tearDown (self ):
33- self .patcher .stop ()
34- super (TestSAPRfcModule , self ).tearDown ()
35-
3633 def test_without_required_parameters (self ):
3734 """Failure must occurs when all parameters are missing"""
3835 with self .assertRaises (AnsibleFailJson ):
Original file line number Diff line number Diff line change @@ -14,19 +14,13 @@ def setUp(self):
1414 'pyrfc' : MagicMock (),
1515 'pyrfc.Connection' : MagicMock ()
1616 }
17- self .patcher = patch .dict ('sys.modules' , self .pyrfc_mock )
18- self .patcher .start ()
17+ patcher = patch .dict ('sys.modules' , self .pyrfc_mock )
18+ patcher .start ()
19+ self .addCleanup (patcher .stop )
1920 super (TestSAPRfcModule , self ).setUp ()
2021 from ansible_collections .community .sap_libs .plugins .modules import sap_snote
2122 self .module = sap_snote
2223
23- def tearDown (self ):
24- self .patcher .stop ()
25- super (TestSAPRfcModule , self ).tearDown ()
26-
27- def define_rfc_connect (self , mocker ):
28- return mocker .patch (self .module .call_rfc_method )
29-
3024 def test_without_required_parameters (self ):
3125 """Failure must occurs when all parameters are missing"""
3226 with self .assertRaises (AnsibleFailJson ):
Original file line number Diff line number Diff line change @@ -16,19 +16,13 @@ def setUp(self):
1616 'xmltodict' : MagicMock (),
1717 'xmltodict.parse' : MagicMock ()
1818 }
19- self .patcher = patch .dict ('sys.modules' , self .mock_modules )
20- self .patcher .start ()
19+ patcher = patch .dict ('sys.modules' , self .mock_modules )
20+ patcher .start ()
21+ self .addCleanup (patcher .stop )
2122 super (TestSAPRfcModule , self ).setUp ()
2223 from ansible_collections .community .sap_libs .plugins .modules import sap_task_list_execute
2324 self .module = sap_task_list_execute
2425
25- def tearDown (self ):
26- self .patcher .stop ()
27- super (TestSAPRfcModule , self ).tearDown ()
28-
29- def define_rfc_connect (self , mocker ):
30- return mocker .patch (self .module .call_rfc_method )
31-
3226 def test_without_required_parameters (self ):
3327 """Failure must occurs when all parameters are missing"""
3428 with self .assertRaises (AnsibleFailJson ):
Original file line number Diff line number Diff line change @@ -14,19 +14,13 @@ def setUp(self):
1414 'pyrfc' : MagicMock (),
1515 'pyrfc.Connection' : MagicMock ()
1616 }
17- self .patcher = patch .dict ('sys.modules' , self .pyrfc_mock )
18- self .patcher .start ()
17+ patcher = patch .dict ('sys.modules' , self .pyrfc_mock )
18+ patcher .start ()
19+ self .addCleanup (patcher .stop )
1920 super (TestSAPRfcModule , self ).setUp ()
2021 from ansible_collections .community .sap_libs .plugins .modules import sap_user
2122 self .module = sap_user
2223
23- def tearDown (self ):
24- self .patcher .stop ()
25- super (TestSAPRfcModule , self ).tearDown ()
26-
27- def define_rfc_connect (self , mocker ):
28- return mocker .patch (self .module .call_rfc_method )
29-
3024 def test_without_required_parameters (self ):
3125 """Failure must occurs when all parameters are missing"""
3226 with self .assertRaises (AnsibleFailJson ):
You can’t perform that action at this time.
0 commit comments