Exemplo n.º 1
0
 def test_module_fail_when_required_args_missing(self,
                                                 mock_create_sf_connection):
     ''' required arguments are reported as errors '''
     with pytest.raises(AnsibleFailJson) as exc:
         set_module_args({})
         my_module()
     print('Info: %s' % exc.value.args[0]['msg'])
 def test_ensure_set_encryption_at_rest_called(self, mock_create_sf_connection):
     ''' test if set_encryption_at_rest is called '''
     module_args = {}
     module_args.update(self.set_default_args())
     module_args.update({'encryption_at_rest': 'present'})
     set_module_args(module_args)
     my_obj = my_module()
     with pytest.raises(AnsibleExitJson) as exc:
         my_obj.apply()
     print('Info: test_set_encryption_at_rest enable: %s' % repr(exc.value))
     assert not exc.value.args[0]['changed']
     module_args.update({'encryption_at_rest': 'absent'})
     set_module_args(module_args)
     my_obj = my_module()
     with pytest.raises(AnsibleExitJson) as exc:
         my_obj.apply()
     print('Info: test_set_encryption_at_rest disable: %s' % repr(exc.value))
     assert not exc.value.args[0]['changed']
Exemplo n.º 3
0
 def test_ensure_enable_feature_called(self, mock_create_sf_connection):
     ''' test if enable_feature for vvols is called '''
     module_args = {}
     module_args.update(self.set_default_args())
     module_args.update({'enable_virtual_volumes': True})
     set_module_args(module_args)
     my_obj = my_module()
     with pytest.raises(AnsibleExitJson) as exc:
         my_obj.apply()
     print('Info: test_enable_feature: %s' % repr(exc.value))
     assert not exc.value.args[0]['changed']
 def test_ensure_setup_ntp_info_called(self, mock_create_sf_connection):
     ''' test if setup_ntp_info is called '''
     module_args = {}
     module_args.update(self.set_default_args())
     ntp_dict = {'set_ntp_info': {'broadcastclient': None,
                 'ntp_servers': ['1.1.1.1']}}
     module_args.update(ntp_dict)
     set_module_args(module_args)
     my_obj = my_module()
     with pytest.raises(AnsibleExitJson) as exc:
         my_obj.apply()
     print('Info: test_setup_ntp_info: %s' % repr(exc.value))
     assert exc.value.args[0]['changed']
 def test_ensure_set_cluster_full_threshold_called(self, mock_create_sf_connection):
     ''' test if set_cluster_full threshold is called '''
     module_args = {}
     module_args.update(self.set_default_args())
     cluster_mod_dict = \
         {'modify_cluster_full_threshold': {'stage2_aware_threshold': 2,
                                            'stage3_block_threshold_percent': 2,
                                            'max_metadata_over_provision_factor': 2}}
     module_args.update(cluster_mod_dict)
     set_module_args(module_args)
     my_obj = my_module()
     with pytest.raises(AnsibleExitJson) as exc:
         my_obj.apply()
     print('Info: test_set_cluster_full_threshold: %s' % repr(exc.value))
     assert exc.value.args[0]['changed']