def test_idempotent_disable_datacenter(self, *args):
        set_module_args(
            dict(state='disabled',
                 password='******',
                 server='localhost',
                 user='******',
                 name='foo'))

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

        current = Parameters(load_fixture('load_gtm_datacenter_disabled.json'))

        mm = ModuleManager(client)

        # Override methods to force specific logic in the module to happen
        mm.exists = Mock(return_value=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 False
        assert results['enabled'] is False
 def test_module_parameters(self):
     args = dict(state='present',
                 contact='foo',
                 description='bar',
                 location='baz',
                 name='datacenter')
     p = Parameters(args)
     assert p.state == 'present'
 def test_module_parameters_state_disabled(self):
     args = dict(state='disabled')
     p = Parameters(args)
     assert p.state == 'disabled'
     assert p.enabled is False
     assert p.disabled is True
 def test_module_parameters_state_absent(self):
     args = dict(state='absent')
     p = Parameters(args)
     assert p.state == 'absent'
 def test_module_parameters_state_present(self):
     args = dict(state='present')
     p = Parameters(args)
     assert p.state == 'present'
     assert p.enabled is True
 def test_api_parameters(self):
     args = load_fixture('load_gtm_datacenter_default.json')
     p = Parameters(args)
     assert p.name == 'asd'