Esempio n. 1
0
 def test_main(self, get_all):
     '''test main method - default: no state.'''
     set_module_args(self.mock_args())
     get_all.side_effect = [
         {'test_get_all': {'vserver_login_banner_info': 'test_vserver_login_banner_info', 'vserver_info': 'test_vserver_info'}}
     ]
     with pytest.raises(AnsibleExitJson) as exc:
         info_main()
     assert 'state' not in exc.value.args[0]
Esempio n. 2
0
 def test_main_with_state(self, get_all):
     '''test main method with explicit state.'''
     args = self.mock_args()
     args['state'] = 'some_state'
     set_module_args(args)
     get_all.side_effect = [
         {'test_get_all': {'vserver_login_banner_info': 'test_vserver_login_banner_info', 'vserver_info': 'test_vserver_info'}}
     ]
     with pytest.raises(AnsibleExitJson) as exc:
         info_main()
     assert exc.value.args[0]['state'] == 'some_state'