Example #1
0
    def test_create_vcmpguest_with_hotfix(self, *args):
        set_module_args(
            dict(name="guest2",
                 mgmt_network="bridged",
                 mgmt_address="10.10.10.10/24",
                 initial_image="BIGIP-14.1.0.3-0.0.6.iso",
                 initial_hotfix="Hotfix-BIGIP-14.1.0.3.0.5.6-ENG.iso",
                 provider=dict(server='localhost',
                               password='******',
                               user='******')))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode,
            required_if=self.spec.required_if)

        # Override methods to force specific logic in the module to happen
        mm = ModuleManager(module=module)
        mm.create_on_device = Mock(return_value=True)
        mm.exists = Mock(return_value=False)
        mm.is_deployed = Mock(side_effect=[False, True, True, True, True])
        mm.deploy_on_device = Mock(return_value=True)

        results = mm.exec_module()

        assert results['changed'] is True
        assert results['name'] == 'guest2'
    def test_create_vlan(self, *args):
        set_module_args(dict(
            name="guest1",
            mgmt_network="bridged",
            mgmt_address="10.10.10.10/24",
            initial_image="BIGIP-13.1.0.0.0.931.iso",
            server='localhost',
            password='******',
            user='******'
        ))

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

        # Override methods to force specific logic in the module to happen
        mm = ModuleManager(module=module)
        mm.create_on_device = Mock(return_value=True)
        mm.exists = Mock(return_value=False)
        mm.is_deployed = Mock(side_effect=[False, True, True, True, True])
        mm.deploy_on_device = Mock(return_value=True)

        results = mm.exec_module()

        assert results['changed'] is True
        assert results['name'] == 'guest1'