Esempio n. 1
0
    def test_change_ip(self, *args):
        set_module_args(
            dict(name='foo',
                 ip='10.10.10.10',
                 port=80,
                 interval=20,
                 timeout=30,
                 server='localhost',
                 password='******',
                 user='******'))

        current = ApiParameters(
            params=load_fixture('load_gtm_monitor_tcp_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=[True, 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
        assert results['ip'] == '10.10.10.10'
Esempio n. 2
0
    def test_api_parameters(self):
        args = load_fixture('load_gtm_monitor_tcp_1.json')

        p = ApiParameters(params=args)
        assert p.name == 'foo'
        assert p.parent == '/Common/tcp'
        assert p.send == 'the send string'
        assert p.receive == 'the receive string'
        assert p.destination == '1.1.1.1:80'
        assert p.ip == '1.1.1.1'
        assert p.port == 80
        assert p.interval == 30
        assert p.timeout == 120
        assert p.ignore_down_response is False
        assert p.transparent is True
        assert p.probe_timeout == 5
        assert p.reverse is True