def test_positive_add_host_by_name(self):
        """Check if content host can be added to host collection by name

        :id: fe468f76-4693-4509-b534-126fce187194

        :customerscenario: true

        :expectedresults: Host collection is created and content-host is added

        :CaseLevel: Integration
        """
        new_host_col = make_host_collection({
            'name': gen_string('alpha', 15),
            'organization-id': self.organization['id'],
        })
        new_system = self._make_fake_host_helper()
        no_of_content_host = new_host_col['total-hosts']
        HostCollection.add_host({
            u'hosts': new_system['name'],
            u'name': new_host_col['name'],
            u'organization': self.organization['name'],
        })
        result = HostCollection.info({
            u'name': new_host_col['name'],
            u'organization': self.organization['name'],
        })
        self.assertGreater(result['total-hosts'], no_of_content_host)
Beispiel #2
0
    def test_positive_remove_chost_by_id(self):
        """Check if content host can be removed from host collection

        @Feature: Host Collection

        @Assert: Host collection is created and content-host is removed

        """
        new_host_col = self._new_host_collection({
            'name': gen_string('alpha', 15)})
        new_system = make_content_host({
            u'content-view-id': self.default_cv['id'],
            u'lifecycle-environment-id': self.library['id'],
            u'name': gen_string('alpha', 15),
            u'organization-id': self.org['id'],
        })
        HostCollection.add_host({
            u'hosts': new_system['id'],
            u'id': new_host_col['id'],
            u'organization-id': self.org['id'],
        })
        no_of_content_host = HostCollection.info({
            u'id': new_host_col['id'],
            u'organization-id': self.org['id']
        })['total-hosts']
        HostCollection.remove_host({
            u'hosts': new_system['id'],
            u'id': new_host_col['id'],
            u'organization-id': self.org['id'],
        })
        result = HostCollection.info({
            u'id': new_host_col['id'],
            u'organization-id': self.org['id'],
        })
        self.assertGreater(no_of_content_host, result['total-hosts'])
    def test_positive_list_by_host_id(self):
        """Check if host collection list can be filtered by associated host id

        :id: de272461-9804-4524-83c8-23e47abfc8e3

        :expectedresults: Only host-collection with specific host is listed

        :CaseLevel: Integration

        :BZ: 1379372
        """
        # Create two host collections within the same org but only one with
        # associated host that will be used for filtering
        host_col = make_host_collection({
            'organization-id': self.organization['id'],
        })
        make_host_collection({'organization-id': self.organization['id']})
        host = self._make_fake_host_helper()
        HostCollection.add_host({
            'host-ids': host['id'],
            'id': host_col['id'],
        })
        host_col = HostCollection.info({
            'id': host_col['id'],
        })
        self.assertEqual(host_col['total-hosts'], '1')
        # List all host collections within organization
        result = HostCollection.list({
            'organization-id': self.organization['id']})
        self.assertGreaterEqual(len(result), 2)
        # Filter list by associated host id
        result = HostCollection.list({'host-id': host['id']})
        self.assertEqual(len(result), 1)
        self.assertEqual(result[0]['id'], host_col['id'])
Beispiel #4
0
    def test_positive_list_hosts(self):
        """Check if content hosts added to host collection is listed

        @Feature: Host Collection

        @Assert: Content-host added to host-collection is listed

        """
        host_col_name = gen_string('alpha', 15)
        new_host_col = self._new_host_collection({'name': host_col_name})
        new_system = make_content_host({
            u'content-view-id': self.default_cv['id'],
            u'lifecycle-environment-id': self.library['id'],
            u'name': gen_string('alpha', 15),
            u'organization-id': self.org['id'],
        })
        no_of_content_host = new_host_col['total-hosts']
        HostCollection.add_host({
            u'hosts': new_system['id'],
            u'id': new_host_col['id'],
            u'organization-id': self.org['id'],
        })
        result = HostCollection.info({
            u'id': new_host_col['id'],
            u'organization-id': self.org['id']
        })
        self.assertGreater(result['total-hosts'], no_of_content_host)
        result = HostCollection.content_hosts({
            u'name': host_col_name,
            u'organization-id': self.org['id']
        })
        self.assertEqual(new_system['id'], result[0]['id'])
def test_positive_host_collection_host_pagination(module_org):
    """Check if pagination configured on per-page param defined in hammer
    host-collection hosts command overrides global configuration defined
    on /etc/hammer/cli_config.yml, which default is 20 per page

    :BZ: 1343583

    :id: bbe1108b-bfb2-4a03-94ef-8fd1b5a0ec82

    :expectedresults: Number of host per page follows per_page
        configuration restriction

    :CaseLevel: Integration
    """
    host_collection = make_host_collection({'organization-id': module_org.id})
    host_ids = ','.join(_make_fake_host_helper(module_org)['id'] for _ in range(2))
    HostCollection.add_host({'host-ids': host_ids, 'id': host_collection['id']})
    for number in range(1, 3):
        listed_hosts = HostCollection.hosts(
            {
                'id': host_collection['id'],
                'organization-id': module_org.id,
                'per-page': number,
            }
        )
        assert len(listed_hosts) == number
Beispiel #6
0
    def test_positive_list_by_host_id(self):
        """Check if host collection list can be filtered by associated host id

        :id: de272461-9804-4524-83c8-23e47abfc8e3

        :expectedresults: Only host-collection with specific host is listed

        :CaseLevel: Integration

        :BZ: 1379372
        """
        # Create two host collections within the same org but only one with
        # associated host that will be used for filtering
        host_col = make_host_collection({
            'organization-id':
            self.organization['id'],
        })
        make_host_collection({'organization-id': self.organization['id']})
        host = self._make_fake_host_helper()
        HostCollection.add_host({
            'host-ids': host['id'],
            'id': host_col['id'],
        })
        host_col = HostCollection.info({
            'id': host_col['id'],
        })
        self.assertEqual(host_col['total-hosts'], '1')
        # List all host collections within organization
        result = HostCollection.list(
            {'organization-id': self.organization['id']})
        self.assertGreaterEqual(len(result), 2)
        # Filter list by associated host id
        result = HostCollection.list({'host-id': host['id']})
        self.assertEqual(len(result), 1)
        self.assertEqual(result[0]['id'], host_col['id'])
Beispiel #7
0
    def test_positive_remove_host_by_id(self):
        """Check if content host can be removed from host collection

        @id: 61f4aab1-398b-4d3a-a4f4-f558ad8d2679

        @Assert: Host collection is created and content-host is removed

        @CaseLevel: Integration
        """
        new_host_col = self._new_host_collection({
            'name': gen_string('alpha', 15)
        })
        new_system = self._make_content_host_helper()
        HostCollection.add_host({
            u'host-ids': new_system['id'],
            u'id': new_host_col['id'],
            u'organization-id': self.org['id'],
        })
        no_of_content_host = HostCollection.info({
            u'id': new_host_col['id'],
            u'organization-id': self.org['id']
        })['total-hosts']
        HostCollection.remove_host({
            u'host-ids': new_system['id'],
            u'id': new_host_col['id'],
            u'organization-id': self.org['id'],
        })
        result = HostCollection.info({
            u'id': new_host_col['id'],
            u'organization-id': self.org['id'],
        })
        self.assertGreater(no_of_content_host, result['total-hosts'])
Beispiel #8
0
    def test_positive_add_host_by_name(self):
        """Check if content host can be added to host collection by name

        :id: fe468f76-4693-4509-b534-126fce187194

        :customerscenario: true

        :expectedresults: Host collection is created and content-host is added

        :CaseLevel: Integration
        """
        new_host_col = make_host_collection({
            'name':
            gen_string('alpha', 15),
            'organization-id':
            self.organization['id'],
        })
        new_system = self._make_fake_host_helper()
        no_of_content_host = new_host_col['total-hosts']
        HostCollection.add_host({
            u'hosts': new_system['name'],
            u'name': new_host_col['name'],
            u'organization': self.organization['name'],
        })
        result = HostCollection.info({
            u'name':
            new_host_col['name'],
            u'organization':
            self.organization['name'],
        })
        self.assertGreater(result['total-hosts'], no_of_content_host)
Beispiel #9
0
    def test_positive_remove_host_by_name(self):
        """Check if content host can be removed from host collection by name

        :id: 924d0137-3a9e-4ecd-9631-c21f7e9a8d5d

        :customerscenario: true

        :expectedresults: Host collection is created and content-host is
            removed

        :CaseLevel: Integration
        """
        new_host_col = make_host_collection({
            'name':
            gen_string('alpha', 15),
            'organization-id':
            self.organization['id'],
        })
        new_system = self._make_fake_host_helper()
        HostCollection.add_host({
            u'host-ids': new_system['id'],
            u'id': new_host_col['id'],
        })
        no_of_content_host = HostCollection.info({
            u'id': new_host_col['id'],
        })['total-hosts']
        HostCollection.remove_host({
            u'host-ids': new_system['id'],
            u'name': new_host_col['name'],
            u'organization': self.organization['name'],
        })
        result = HostCollection.info({
            u'id': new_host_col['id'],
        })
        self.assertGreater(no_of_content_host, result['total-hosts'])
Beispiel #10
0
    def test_positive_add_host_by_id(self):
        """Check if content host can be added to host collection by id

        :id: db987da4-6326-43d5-a4c5-93a0c4da7f00

        :expectedresults: Host collection is created and content-host is added

        :CaseLevel: Integration
        """
        new_host_col = make_host_collection({
            'name':
            gen_string('alpha', 15),
            'organization-id':
            self.organization['id'],
        })
        new_system = self._make_fake_host_helper()
        no_of_content_host = new_host_col['total-hosts']
        HostCollection.add_host({
            u'host-ids': new_system['id'],
            u'id': new_host_col['id'],
        })
        result = HostCollection.info({
            u'id': new_host_col['id'],
        })
        self.assertGreater(result['total-hosts'], no_of_content_host)
Beispiel #11
0
    def test_positive_list_hosts(self):
        """Check if content hosts added to host collection is listed

        @id: 3075cb97-8448-4358-8ffc-0d5cd0078ca3

        @Assert: Content-host added to host-collection is listed

        @CaseLevel: Integration
        """
        host_col_name = gen_string('alpha', 15)
        new_host_col = self._new_host_collection({'name': host_col_name})
        new_system = self._make_content_host_helper()
        no_of_content_host = new_host_col['total-hosts']
        HostCollection.add_host({
            u'host-ids': new_system['id'],
            u'id': new_host_col['id'],
            u'organization-id': self.org['id'],
        })
        result = HostCollection.info({
            u'id': new_host_col['id'],
            u'organization-id': self.org['id']
        })
        self.assertGreater(result['total-hosts'], no_of_content_host)
        result = HostCollection.hosts({
            u'name': host_col_name,
            u'organization-id': self.org['id']
        })
        self.assertEqual(new_system['name'].lower(), result[0]['name'])
    def test_positive_add_host_by_id(self):
        """Check if content host can be added to host collection

        @id: db987da4-6326-43d5-a4c5-93a0c4da7f00

        @Assert: Host collection is created and content-host is added

        @CaseLevel: Integration
        """
        new_host_col = self._new_host_collection({
            'name': gen_string('alpha', 15)})
        new_system = make_content_host({
            u'content-view-id': self.default_cv['id'],
            u'lifecycle-environment-id': self.library['id'],
            u'name': gen_string('alpha', 15),
            u'organization-id': self.org['id'],
        })
        no_of_content_host = new_host_col['total-hosts']
        HostCollection.add_host({
            u'host-ids': new_system['id'],
            u'id': new_host_col['id'],
            u'organization-id': self.org['id'],
        })
        result = HostCollection.info({
            u'id': new_host_col['id'],
            u'organization-id': self.org['id']
        })
        self.assertGreater(result['total-hosts'], no_of_content_host)
    def test_positive_remove_host_by_name(self):
        """Check if content host can be removed from host collection by name

        :id: 924d0137-3a9e-4ecd-9631-c21f7e9a8d5d

        :customerscenario: true

        :expectedresults: Host collection is created and content-host is
            removed

        :CaseLevel: Integration
        """
        new_host_col = make_host_collection({
            'name': gen_string('alpha', 15),
            'organization-id': self.organization['id'],
        })
        new_system = self._make_fake_host_helper()
        HostCollection.add_host({
            u'host-ids': new_system['id'],
            u'id': new_host_col['id'],
        })
        no_of_content_host = HostCollection.info({
            u'id': new_host_col['id'],
        })['total-hosts']
        HostCollection.remove_host({
            u'host-ids': new_system['id'],
            u'name': new_host_col['name'],
            u'organization': self.organization['name'],
        })
        result = HostCollection.info({
            u'id': new_host_col['id'],
        })
        self.assertGreater(no_of_content_host, result['total-hosts'])
Beispiel #14
0
    def test_positive_host_collection_host_pagination(self):
        """Check if pagination configured on per-page param defined in hammer
        host-collection hosts command overrides global configuration defined
        on /etc/hammer/cli_config.yml, which default is 20 per page

        @BZ: 1343583

        @id: bbe1108b-bfb2-4a03-94ef-8fd1b5a0ec82

        @Assert: Number of host per page follows per_page configuration
        restriction

        @CaseLevel: Integration
        """
        host_collection = self._new_host_collection({
            'name': gen_string('alpha', 15)
        })
        host_ids = ','.join(
            self._make_content_host_helper()['id'] for i in range(2)
        )
        HostCollection.add_host({
            u'host-ids': host_ids,
            u'id': host_collection['id'],
            u'organization-id': self.org['id'],
        })

        for number in range(1, 3):
            listed_hosts = HostCollection.hosts({
                u'id': host_collection['id'],
                u'organization-id': self.org['id'],
                u'per-page': number
            })
            self.assertEqual(len(listed_hosts), number)
Beispiel #15
0
def test_positive_register_host_ak_with_host_collection(
        katello_agent_client, module_cv, module_lce, module_org,
        rhel7_contenthost, default_sat):
    """Attempt to register a host using activation key with host collection

    :id: 7daf4e40-3fa6-42af-b3f7-1ca1a5c9bfeb

    :BZ: 1385814

    :expectedresults: Host successfully registered and listed in host
        collection

    :CaseLevel: System
    """
    # client = katello_agent_client['client']
    host_info = katello_agent_client['host_info']
    # create a new activation key
    activation_key = make_activation_key({
        'lifecycle-environment-id':
        module_lce.id,
        'organization-id':
        module_org.id,
        'content-view-id':
        module_cv.id,
    })
    hc = make_host_collection({'organization-id': module_org.id})
    ActivationKey.add_host_collection({
        'id': activation_key['id'],
        'organization-id': module_org.id,
        'host-collection-id': hc['id'],
    })
    # add the registered instance host to collection
    HostCollection.add_host({
        'id': hc['id'],
        'organization-id': module_org.id,
        'host-ids': host_info['id']
    })

    with VMBroker(nick='rhel7', host_classes={'host': ContentHost}) as vm:
        vm.install_katello_ca(default_sat)
        # register the client host with the current activation key
        vm.register_contenthost(module_org.name,
                                activation_key=activation_key['name'])
        assert vm.subscribed
        # note: when registering the host, it should be automatically added to the host-collection
        client_host = Host.info({'name': vm.hostname})
        hosts = HostCollection.hosts({
            'id': hc['id'],
            'organization-id': module_org.id
        })
        assert len(hosts) == 2
        expected_hosts_ids = {host_info['id'], client_host['id']}
        hosts_ids = {host['id'] for host in hosts}
        assert hosts_ids == expected_hosts_ids
Beispiel #16
0
    def test_positive_register_host_ak_with_host_collection(self):
        """Attempt to register a host using activation key with host collection

        :id: 7daf4e40-3fa6-42af-b3f7-1ca1a5c9bfeb

        :BZ: 1385814

        :expectedresults: Host successfully registered and listed in host
            collection

        :CaseLevel: System
        """
        # create a new activation key
        activation_key = make_activation_key({
            'lifecycle-environment-id':
            self.env['id'],
            'organization-id':
            self.org['id'],
            'content-view-id':
            self.content_view['id'],
        })
        hc = make_host_collection({'organization-id': self.org['id']})
        ActivationKey.add_host_collection({
            'id': activation_key['id'],
            'organization-id': self.org['id'],
            'host-collection-id': hc['id'],
        })
        # add the registered instance host to collection
        HostCollection.add_host({
            'id': hc['id'],
            'organization-id': self.org['id'],
            'host-ids': self.host['id']
        })
        with VirtualMachine() as client:
            client.create()
            client.install_katello_ca()
            # register the client host with the current activation key
            client.register_contenthost(self.org['name'],
                                        activation_key=activation_key['name'])
            assert client.subscribed
            # note: when registering the host, it should be automatically added
            # to the host collection
            client_host = Host.info({'name': client.hostname})
            hosts = HostCollection.hosts({
                'id': hc['id'],
                'organization-id': self.org['id']
            })
            assert len(hosts) == 2
            expected_hosts_ids = {self.host['id'], client_host['id']}
            hosts_ids = {host['id'] for host in hosts}
            assert hosts_ids == expected_hosts_ids
Beispiel #17
0
    def test_positive_list_by_host_name(self):
        """Check if host collection list can be filtered by
        associated host name

        :id: 2a99e11f-50b8-48b4-8dce-e6ad8ff9c051

        :expectedresults: Only host-collection with specific host is listed

        :CaseLevel: Integration

        :BZ: 1379372
        """
        # Create two host collections within the same org but only one with
        # associated host that will be used for filtering
        host_col = make_host_collection({
            'organization-id':
            self.organization['id'],
        })
        make_host_collection({'organization-id': self.organization['id']})
        host = self._make_fake_host_helper()
        HostCollection.add_host({
            'hosts': host['name'],
            'name': host_col['name'],
            'organization': self.organization['name'],
        })
        host_col = HostCollection.info({
            'name':
            host_col['name'],
            'organization':
            self.organization['name']
        })
        self.assertEqual(host_col['total-hosts'], '1')
        # List all host collections within organization
        result = HostCollection.list(
            {'organization': self.organization['name']})
        self.assertGreaterEqual(len(result), 2)
        # Filter list by associated host name
        result = HostCollection.list({
            'organization': self.organization['name'],
            'host': host['name']
        })
        self.assertEqual(len(result), 1)
        self.assertEqual(result[0]['name'], host_col['name'])
Beispiel #18
0
def test_positive_register_host_ak_with_host_collection(
        module_org, module_ak_with_cv, default_sat):
    """Attempt to register a host using activation key with host collection

    :id: 62459e8a-0cfa-44ff-b70c-7f55b4757d66

    :expectedresults: Host successfully registered and listed in host collection

    :BZ: 1385814

    :CaseLevel: System
    """
    host_info = _make_fake_host_helper(module_org)

    hc = make_host_collection({'organization-id': module_org.id})
    ActivationKey.add_host_collection({
        'id': module_ak_with_cv.id,
        'organization-id': module_org.id,
        'host-collection-id': hc['id'],
    })
    # add the registered instance host to collection
    HostCollection.add_host({
        'id': hc['id'],
        'organization-id': module_org.id,
        'host-ids': host_info['id']
    })

    with VMBroker(nick='rhel7', host_classes={'host': ContentHost}) as client:
        client.install_katello_ca(default_sat)
        # register the client host with the current activation key
        client.register_contenthost(module_org.name,
                                    activation_key=module_ak_with_cv.name)
        assert client.subscribed
        # note: when registering the host, it should be automatically added to the host-collection
        client_host = Host.info({'name': client.hostname})
        hosts = HostCollection.hosts({
            'id': hc['id'],
            'organization-id': module_org.id
        })
        assert len(hosts) == 2
        expected_hosts_ids = {host_info['id'], client_host['id']}
        hosts_ids = {host['id'] for host in hosts}
        assert hosts_ids == expected_hosts_ids
Beispiel #19
0
def host_collection(module_org, module_ak_cv_lce, register_hosts):
    """Create and setup host collection."""
    host_collection = make_host_collection({'organization-id': module_org.id})
    host_ids = [
        Host.info({'name': host.hostname})['id'] for host in register_hosts
    ]
    HostCollection.add_host({
        'id': host_collection['id'],
        'organization-id': module_org.id,
        'host-ids': host_ids,
    })
    ActivationKey.add_host_collection({
        'id':
        module_ak_cv_lce.id,
        'host-collection-id':
        host_collection['id'],
        'organization-id':
        module_org.id,
    })
    return host_collection
    def test_positive_list_by_host_name(self):
        """Check if host collection list can be filtered by
        associated host name

        :id: 2a99e11f-50b8-48b4-8dce-e6ad8ff9c051

        :expectedresults: Only host-collection with specific host is listed

        :CaseLevel: Integration

        :BZ: 1379372
        """
        # Create two host collections within the same org but only one with
        # associated host that will be used for filtering
        host_col = make_host_collection({
            'organization-id': self.organization['id'],
        })
        make_host_collection({'organization-id': self.organization['id']})
        host = self._make_fake_host_helper()
        HostCollection.add_host({
            'hosts': host['name'],
            'name': host_col['name'],
            'organization': self.organization['name'],
        })
        host_col = HostCollection.info({
            'name': host_col['name'],
            'organization': self.organization['name']
        })
        self.assertEqual(host_col['total-hosts'], '1')
        # List all host collections within organization
        result = HostCollection.list({
            'organization': self.organization['name']})
        self.assertGreaterEqual(len(result), 2)
        # Filter list by associated host name
        result = HostCollection.list({
            'organization': self.organization['name'],
            'host': host['name']
        })
        self.assertEqual(len(result), 1)
        self.assertEqual(result[0]['name'], host_col['name'])
    def test_positive_add_host_by_id(self):
        """Check if content host can be added to host collection by id

        :id: db987da4-6326-43d5-a4c5-93a0c4da7f00

        :expectedresults: Host collection is created and content-host is added

        :CaseLevel: Integration
        """
        new_host_col = make_host_collection({
            'name': gen_string('alpha', 15),
            'organization-id': self.organization['id'],
        })
        new_system = self._make_fake_host_helper()
        no_of_content_host = new_host_col['total-hosts']
        HostCollection.add_host({
            u'host-ids': new_system['id'],
            u'id': new_host_col['id'],
        })
        result = HostCollection.info({
            u'id': new_host_col['id'],
        })
        self.assertGreater(result['total-hosts'], no_of_content_host)
Beispiel #22
0
def test_positive_end_to_end(module_org):
    """Check if host collection can be created with name and description,
    content host can be added and removed, host collection can be listed,
    updated and deleted

    :id: 2d3b718e-6f57-4c83-aedb-15604cc8a4bd

    :expectedresults: Host collection is created and has expected name and
        description, content-host is added and removed, host collection is
        updated and deleted.

    :CaseImportance: Critical
    """
    name = list(valid_data_list().values())[0]
    desc = list(valid_data_list().values())[0]
    new_host_col = make_host_collection(
        {'description': desc, 'name': name, 'organization-id': module_org.id}
    )
    assert new_host_col['name'] == name
    assert new_host_col['description'] == desc

    # add host
    new_system = _make_fake_host_helper(module_org)
    no_of_content_host = new_host_col['total-hosts']
    HostCollection.add_host({'host-ids': new_system['id'], 'id': new_host_col['id']})
    result = HostCollection.info({'id': new_host_col['id']})
    assert result['total-hosts'] > no_of_content_host

    # list hosts
    result = HostCollection.hosts({'name': name, 'organization-id': module_org.id})
    assert new_system['name'].lower() == result[0]['name']
    # List all host collections within organization
    result = HostCollection.list({'organization': module_org.name})
    assert len(result) >= 1
    # Filter list by name
    result = HostCollection.list({'name': name, 'organization-id': module_org.id})
    assert len(result) == 1
    assert result[0]['id'] == new_host_col['id']
    # Filter list by associated host name
    result = HostCollection.list({'organization': module_org.name, 'host': new_system['name']})
    assert len(result) == 1
    assert result[0]['name'] == new_host_col['name']

    # remove host
    no_of_content_host = HostCollection.info({'id': new_host_col['id']})['total-hosts']
    HostCollection.remove_host({'host-ids': new_system['id'], 'id': new_host_col['id']})
    result = HostCollection.info({'id': new_host_col['id']})
    assert no_of_content_host > result['total-hosts']

    # update
    new_name = list(valid_data_list().values())[0]
    new_desc = list(valid_data_list().values())[0]
    HostCollection.update(
        {'description': new_desc, 'id': new_host_col['id'], 'new-name': new_name}
    )
    result = HostCollection.info({'id': new_host_col['id']})
    assert result['name'] == new_name
    assert result['description'] == new_desc

    # delete
    HostCollection.delete({'id': new_host_col['id']})
    with pytest.raises(CLIReturnCodeError):
        HostCollection.info({'id': new_host_col['id']})
Beispiel #23
0
    def test_positive_end_to_end(self):
        """Check if host collection can be created with name and description,
        content host can be added and removed, host collection can be listed,
        updated and deleted

        :id: 2d3b718e-6f57-4c83-aedb-15604cc8a4bd

        :expectedresults: Host collection is created and has expected name and
            description, content-host is added and removed, host collection is
            updated and deleted.

        :CaseImportance: Critical
        """
        name = valid_data_list()[0]
        desc = valid_data_list()[0]
        new_host_col = make_host_collection({
            'description':
            desc,
            'name':
            name,
            'organization-id':
            self.organization['id']
        })
        self.assertEqual(new_host_col['name'], name)
        self.assertEqual(new_host_col['description'], desc)

        # add host
        new_system = self._make_fake_host_helper()
        no_of_content_host = new_host_col['total-hosts']
        HostCollection.add_host({
            'host-ids': new_system['id'],
            'id': new_host_col['id']
        })
        result = HostCollection.info({'id': new_host_col['id']})
        self.assertGreater(result['total-hosts'], no_of_content_host)

        # list hosts
        result = HostCollection.hosts({
            'name':
            name,
            'organization-id':
            self.organization['id']
        })
        self.assertEqual(new_system['name'].lower(), result[0]['name'])
        # List all host collections within organization
        result = HostCollection.list(
            {'organization': self.organization['name']})
        self.assertGreaterEqual(len(result), 2)
        # Filter list by name
        result = HostCollection.list({
            'name': name,
            'organization-id': self.organization['id']
        })
        self.assertEqual(len(result), 1)
        self.assertEqual(result[0]['id'], new_host_col['id'])
        # Filter list by associated host name
        result = HostCollection.list({
            'organization': self.organization['name'],
            'host': new_system['name']
        })
        self.assertEqual(len(result), 1)
        self.assertEqual(result[0]['name'], new_host_col['name'])

        # remove host
        no_of_content_host = HostCollection.info({'id': new_host_col['id']
                                                  })['total-hosts']
        HostCollection.remove_host({
            'host-ids': new_system['id'],
            'id': new_host_col['id']
        })
        result = HostCollection.info({'id': new_host_col['id']})
        self.assertGreater(no_of_content_host, result['total-hosts'])

        # update
        new_name = valid_data_list()[0]
        new_desc = valid_data_list()[0]
        HostCollection.update({
            'description': new_desc,
            'id': new_host_col['id'],
            'new-name': new_name
        })
        result = HostCollection.info({'id': new_host_col['id']})
        self.assertEqual(result['name'], new_name)
        self.assertEqual(result['description'], new_desc)

        # delete
        HostCollection.delete({'id': new_host_col['id']})
        with self.assertRaises(CLIReturnCodeError):
            HostCollection.info({'id': new_host_col['id']})