Exemple #1
0
    def test_update_allowed_addresses_empty(self, *args):
        set_module_args(dict(
            allowed_addresses=[''],
            provider=dict(
                server='localhost',
                password='******',
                user='******'
            )
        ))

        # Configure the parameters that would be returned by querying the
        # remote device
        current = ApiParameters(
            params=dict(
                allowed_addresses=['10.0.0.0']
            )
        )

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode
        )
        mm = ModuleManager(module=module)

        # Override methods to force specific logic in the module to happen
        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
        assert len(results['allowed_addresses']) == 1
        assert results['allowed_addresses'] == ['127.0.0.0/8']
Exemple #2
0
    def test_update_agent_status_traps(self, *args):
        set_module_args(dict(
            agent_status_traps='enabled',
            password='******',
            server='localhost',
            user='******'
        ))

        # Configure the parameters that would be returned by querying the
        # remote device
        current = ApiParameters(
            params=dict(
                agent_status_traps='disabled'
            )
        )

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode
        )
        mm = ModuleManager(module=module)

        # Override methods to force specific logic in the module to happen
        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
        assert results['agent_status_traps'] == 'enabled'
Exemple #3
0
 def test_api_parameters_disabled(self):
     args = dict(
         agentTrap='disabled',
         authTrap='disabled',
         bigipTraps='disabled',
     )
     p = ApiParameters(params=args)
     assert p.agent_status_traps == 'disabled'
     assert p.agent_authentication_traps == 'disabled'
     assert p.device_warning_traps == 'disabled'
Exemple #4
0
 def test_api_parameters(self):
     args = dict(
         agentTrap='enabled',
         authTrap='enabled',
         bigipTraps='enabled',
         sysLocation='Lunar orbit',
         sysContact='*****@*****.**',
     )
     p = ApiParameters(params=args)
     assert p.agent_status_traps == 'enabled'
     assert p.agent_authentication_traps == 'enabled'
     assert p.device_warning_traps == 'enabled'
     assert p.location == 'Lunar orbit'
     assert p.contact == '*****@*****.**'