def test_get_volume_filter_on_active(self, *args):
        set_module_args(dict(
            server='localhost',
            password='******',
            user='******',
            include='volume',
            filter='active:true'
        ))

        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)
        mm.exit_json = Mock(return_value=False)
        results = mm.exec_module()
        volumes = results['volumes'][0]

        assert results['changed'] is True
        assert 'images' not in results.keys()
        assert 'hotfixes' not in results.keys()
        assert len(results['volumes']) == 1
        assert 'product' in volumes.keys()
        assert 'name' in volumes.keys()
        assert volumes['product'] == 'BIG-IP'
        assert volumes['name'] == 'HD1.1'
Exemple #2
0
    def test_get_all_facts_filter_on_version(self, *args):
        set_module_args(
            dict(server='localhost',
                 password='******',
                 user='******',
                 include='all',
                 filter='version:12.1.1'))

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

        mm = ModuleManager(module=module)
        mm.exit_json = Mock(return_value=False)
        results = mm.exec_module()
        images = results['images'][0]
        volumes = results['volumes'][0]

        assert results['changed'] is True
        assert len(results['hotfixes']) == 0
        assert len(results['images']) == 1
        assert len(results['volumes']) == 1
        assert 'product' in images.keys()
        assert 'name' in images.keys()
        assert 'product' in volumes.keys()
        assert 'name' in volumes.keys()
        assert images['product'] == 'BIG-IP'
        assert images['name'] == 'BIGIP-12.1.1.0.0.184.iso'
        assert volumes['product'] == 'BIG-IP'
        assert volumes['name'] == 'HD1.2'
Exemple #3
0
    def test_get_image_and_hotfixes_no_filter(self, *args):
        set_module_args(
            dict(server='localhost',
                 password='******',
                 user='******',
                 include=['image', 'hotfix']))

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

        mm = ModuleManager(module=module)
        mm.exit_json = Mock(return_value=False)
        results = mm.exec_module()

        assert results['changed'] is True
        assert len(results['images']) == 8
        assert len(results['hotfixes']) == 5
        assert 'volumes' not in results.keys()
    def test_get_hotfixes_no_filter(self, *args):
        set_module_args(
            dict(server='localhost',
                 password='******',
                 user='******',
                 include='hotfix'))

        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)
        mm.exit_json = Mock(return_value=False)
        results = mm.exec_module()

        assert results['changed'] is True
        assert 'images' not in results.keys()
        assert 'volumes' not in results.keys()
        assert len(results['hotfixes']) == 5