def test_create_partition(self, *args): set_module_args( dict(expiration_warning=7, max_duration=9999, max_login_failures=0, min_duration=0, min_length=6, password_memory=0, policy_enforcement='no', required_lowercase=0, required_numeric=0, required_special=0, required_uppercase=0, provider=dict(server='localhost', password='******', user='******'))) current = ApiParameters( params=load_fixture('load_tm_auth_password_policy_1.json')) module = AnsibleModule( argument_spec=self.spec.argument_spec, supports_check_mode=self.spec.supports_check_mode) # Override methods in the specific type of manager mm = ModuleManager(module=module) mm.exists = Mock(side_effect=[False, True]) mm.update_on_device = Mock(return_value=True) mm.read_current_from_device = Mock(return_value=current) results = mm.exec_module() assert results['changed'] is True
def test_api_parameters(self): args = load_fixture('load_tm_auth_password_policy_1.json') p = ApiParameters(params=args) assert p.expiration_warning == 7 assert p.max_duration == 99999 assert p.max_login_failures == 0 assert p.min_duration == 0 assert p.password_memory == 0 assert p.policy_enforcement == 'no' assert p.required_lowercase == 0 assert p.required_numeric == 0 assert p.required_special == 0 assert p.required_uppercase == 0