예제 #1
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 = Parameters(dict(agent_status_traps='disabled'))

        client = AnsibleF5Client(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode,
            f5_product_name=self.spec.f5_product_name)
        mm = ModuleManager(client)

        # 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'
예제 #2
0
 def test_api_parameters_disabled(self):
     args = dict(
         agentTrap='disabled',
         authTrap='disabled',
         bigipTraps='disabled',
     )
     p = Parameters(args)
     assert p.agent_status_traps == 'disabled'
     assert p.agent_authentication_traps == 'disabled'
     assert p.device_warning_traps == 'disabled'
예제 #3
0
 def test_module_parameters_disabled(self):
     args = dict(agent_status_traps='disabled',
                 agent_authentication_traps='disabled',
                 device_warning_traps='disabled',
                 password='******',
                 server='localhost',
                 user='******')
     p = Parameters(args)
     assert p.agent_status_traps == 'disabled'
     assert p.agent_authentication_traps == 'disabled'
     assert p.device_warning_traps == 'disabled'
예제 #4
0
 def test_api_parameters(self):
     args = dict(
         agentTrap='enabled',
         authTrap='enabled',
         bigipTraps='enabled',
         sysLocation='Lunar orbit',
         sysContact='*****@*****.**',
     )
     p = Parameters(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 == '*****@*****.**'
예제 #5
0
 def test_module_parameters(self):
     args = dict(agent_status_traps='enabled',
                 agent_authentication_traps='enabled',
                 contact='*****@*****.**',
                 device_warning_traps='enabled',
                 location='Lunar orbit',
                 password='******',
                 server='localhost',
                 user='******')
     p = Parameters(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 == '*****@*****.**'