Пример #1
0
    def test_positive_delete_1(self, test_data):
        """@Test: Check if content host can be created and deleted

        @Feature: Content Hosts

        @Assert: Content host is created and then deleted

        """

        new_system = make_content_host({
            u'name':
            test_data['name'],
            u'organization-id':
            self.NEW_ORG['id'],
            u'content-view-id':
            self.DEFAULT_CV['id'],
            u'lifecycle-environment-id':
            self.LIBRARY['id']
        })
        # Assert that name matches data passed
        self.assertEqual(new_system['name'], test_data['name'],
                         "Names don't match")

        # Delete it
        result = ContentHost.delete({u'id': new_system['id']})
        self.assertEqual(result.return_code, 0, "Content host was not deleted")
        self.assertEqual(len(result.stderr), 0, "No error was expected")

        # Fetch it
        result = ContentHost.info({u'id': new_system['id']})
        self.assertNotEqual(result.return_code, 0,
                            "Content host should not be found")
        self.assertGreater(len(result.stderr), 0, "Expected an error here")
Пример #2
0
    def test_positive_unregister(self):
        """Unregister Content host

        @feature: Content host

        @assert: After unregistering, Content hosts list for the org does not
        show the Content host
        """
        activation_key = make_activation_key({
            'content-view-id': self.PROMOTED_CV['id'],
            'lifecycle-environment-id': self.NEW_LIFECYCLE['id'],
            'organization-id': self.NEW_ORG['id'],
        })
        with VirtualMachine(distro='rhel71') as client:
            client.install_katello_ca()
            client.register_contenthost(
                activation_key['name'],
                self.NEW_ORG['label'],
            )
            result = ContentHost.list({'organization-id': self.NEW_ORG['id']})
            self.assertGreaterEqual(len(result), 1)
            self.assertIn(client.hostname, [chost['name'] for chost in result])
            result = client.run('subscription-manager unregister')
            self.assertEqual(result.return_code, 0)
            result = ContentHost.list({'organization-id': self.NEW_ORG['id']})
            self.assertNotIn(
                client.hostname, [chost['name'] for chost in result])
Пример #3
0
    def test_positive_update_name(self):
        """Check if content host name can be updated

        @id: 056fff14-e9ea-407e-8340-1d5b5da1e4e4

        @Assert: Content host is created and name is updated

        @BZ: 1318686, 1338780
        """
        new_system = make_content_host({
            u'content-view-id':
            self.DEFAULT_CV['id'],
            u'lifecycle-environment-id':
            self.LIBRARY['id'],
            u'organization-id':
            self.NEW_ORG['id'],
        })
        for new_name in valid_hosts_list():
            with self.subTest(new_name):
                ContentHost.update({
                    u'id': new_system['id'],
                    u'new-name': new_name,
                })
                result = ContentHost.info({'id': new_system['id']})
                self.assertEqual(result['name'], new_name)
Пример #4
0
    def test_positive_update_1(self, test_data):
        """@Test: Check if content host name can be updated

        @Feature: Content Hosts

        @Assert: Content host is created and name is updated

        """
        new_system = None
        try:
            new_system = make_content_host({
                u'organization-id': self.NEW_ORG['id'],
                u'content-view-id': self.DEFAULT_CV['id'],
                u'lifecycle-environment-id': self.LIBRARY['id']})
        except CLIFactoryError as err:
            self.fail(err)
        # Assert that name does not matches data passed
        self.assertNotEqual(
            new_system['name'],
            test_data['name'],
            "Names should not match"
        )

        # Update system group
        result = ContentHost.update({
            u'id': new_system['id'],
            u'name': test_data['name']})
        self.assertEqual(
            result.return_code,
            0,
            "Content host was not updated")
        self.assertEqual(
            len(result.stderr), 0, "No error was expected")

        # Fetch it
        result = ContentHost.info({
            u'id': new_system['id']})
        self.assertEqual(
            result.return_code,
            0,
            "Content host was not updated")
        self.assertEqual(
            len(result.stderr), 0, "No error was expected")
        # Assert that name matches new value
        self.assertIsNotNone(
            result.stdout.get('name', None),
            "The name field was not returned"
        )
        self.assertEqual(
            result.stdout['name'],
            test_data['name'],
            "Names should match"
        )
        # Assert that name does not match original value
        self.assertNotEqual(
            new_system['name'],
            result.stdout['name'],
            "Names should not match"
        )
Пример #5
0
    def test_positive_update_2(self, test_data):
        """@Test: Check if content host description can be updated

        @Feature: Content Hosts

        @Assert: Content host is created and description is updated

        @BZ: 1082157

        """

        new_system = make_content_host({
            u'organization-id': self.NEW_ORG['id'],
            u'content-view-id': self.DEFAULT_CV['id'],
            u'lifecycle-environment-id': self.LIBRARY['id']})
        # Assert that description does not match data passed
        self.assertNotEqual(
            new_system['description'],
            test_data['description'],
            "Descriptions should not match"
        )

        # Update sync plan
        result = ContentHost.update({
            u'id': new_system['id'],
            u'description': test_data['description']})
        self.assertEqual(
            result.return_code,
            0,
            "Content host was not updated")
        self.assertEqual(
            len(result.stderr), 0, "No error was expected")

        # Fetch it
        result = ContentHost.info({
            u'id': new_system['id']})
        self.assertEqual(
            result.return_code,
            0,
            "Content host was not updated")
        self.assertEqual(
            len(result.stderr), 0, "No error was expected")
        # Assert that description matches new value
        self.assertIsNotNone(
            result.stdout.get('description', None),
            "The description field was not returned"
        )
        self.assertEqual(
            result.stdout['description'],
            test_data['description'],
            "Descriptions should match"
        )
        # Assert that description does not matches original value
        self.assertNotEqual(
            new_system['description'],
            result.stdout['description'],
            "Descriptions should not match"
        )
Пример #6
0
    def test_positive_update_2(self, test_data):
        """
        @Test: Check if content host description can be updated
        @Feature: Content Hosts
        @Assert: Content host is created and description is updated
        @BZ: 1082157
        """

        new_system = make_content_host({
            u'organization-id': self.NEW_ORG['id'],
            u'content-view-id': self.DEFAULT_CV['id'],
            u'environment-id': self.LIBRARY['id']})
        # Assert that description does not match data passed
        self.assertNotEqual(
            new_system['description'],
            test_data['description'],
            "Descriptions should not match"
        )

        # Update sync plan
        result = ContentHost.update({
            u'id': new_system['id'],
            u'description': test_data['description']})
        self.assertEqual(
            result.return_code,
            0,
            "Content host was not updated")
        self.assertEqual(
            len(result.stderr), 0, "No error was expected")

        # Fetch it
        result = ContentHost.info({
            u'id': new_system['id']})
        self.assertEqual(
            result.return_code,
            0,
            "Content host was not updated")
        self.assertEqual(
            len(result.stderr), 0, "No error was expected")
        # Assert that description matches new value
        self.assertIsNotNone(
            result.stdout.get('description', None),
            "The description field was not returned"
        )
        self.assertEqual(
            result.stdout['description'],
            test_data['description'],
            "Descriptions should match"
        )
        # Assert that description does not matches original value
        self.assertNotEqual(
            new_system['description'],
            result.stdout['description'],
            "Descriptions should not match"
        )
Пример #7
0
    def test_positive_update_1(self, test_data):
        """
        @Test: Check if content host name can be updated
        @Feature: Content Hosts
        @Assert: Content host is created and name is updated
        """

        new_system = make_content_host({
            u'organization-id': self.NEW_ORG['id'],
            u'content-view-id': self.DEFAULT_CV['id'],
            u'environment-id': self.LIBRARY['id']})
        # Assert that name does not matches data passed
        self.assertNotEqual(
            new_system['name'],
            test_data['name'],
            "Names should not match"
        )

        # Update system group
        result = ContentHost.update({
            u'id': new_system['id'],
            u'name': test_data['name']})
        self.assertEqual(
            result.return_code,
            0,
            "Content host was not updated")
        self.assertEqual(
            len(result.stderr), 0, "No error was expected")

        # Fetch it
        result = ContentHost.info({
            u'id': new_system['id']})
        self.assertEqual(
            result.return_code,
            0,
            "Content host was not updated")
        self.assertEqual(
            len(result.stderr), 0, "No error was expected")
        # Assert that name matches new value
        self.assertIsNotNone(
            result.stdout.get('name', None),
            "The name field was not returned"
        )
        self.assertEqual(
            result.stdout['name'],
            test_data['name'],
            "Names should match"
        )
        # Assert that name does not match original value
        self.assertNotEqual(
            new_system['name'],
            result.stdout['name'],
            "Names should not match"
        )
Пример #8
0
    def test_positive_upgrade_packages_all(self):
        """Upgrade all the content host packages remotely

        @Feature: Content Host - Package

        @Assert: Packages (at least 1 with newer version available) were
        successfully upgraded

        """
        self.client.run("yum install -y {0}".format(FAKE_1_CUSTOM_PACKAGE))
        ContentHost.package_upgrade_all(
            {u"content-host": self.client.hostname, u"organization-id": KatelloAgentTestCase.org["id"]}
        )
        result = self.client.run("rpm -q {0}".format(FAKE_2_CUSTOM_PACKAGE))
        self.assertEqual(result.return_code, 0)
Пример #9
0
    def test_positive_list(self):
        """List Content hosts for a given org

        @id: b9c056cd-11ca-4870-bac4-0ebc4a782cb0

        @Assert: Content hosts are listed for the given org

        @CaseLevel: System
        """
        activation_key = make_activation_key({
            'content-view-id': self.PROMOTED_CV['id'],
            'lifecycle-environment-id': self.NEW_LIFECYCLE['id'],
            'organization-id': self.NEW_ORG['id'],
        })
        with VirtualMachine(distro='rhel71') as client:
            client.install_katello_ca()
            client.register_contenthost(
                activation_key['name'],
                self.NEW_ORG['label'],
            )
            result = ContentHost.list({
                'organization-id': self.NEW_ORG['id'],
                'lifecycle-environment-id': self.NEW_LIFECYCLE['id'],
            })
            self.assertGreaterEqual(len(result), 1)
            self.assertIn(client.hostname, [chost['name'] for chost in result])
Пример #10
0
    def test_positive_install_package_group(self):
        """@Test: Install package group to content host remotely

        @Feature: Content Host - Package group

        @Assert: Package group was successfully installed

        """
        ContentHost.package_group_install({
            u'content-host': self.client.hostname,
            u'groups': FAKE_0_CUSTOM_PACKAGE_GROUP_NAME,
            u'organization-id': KatelloAgentTestCase.org['id'],
        })
        for package in FAKE_0_CUSTOM_PACKAGE_GROUP:
            result = self.client.run('rpm -q {0}'.format(package))
            self.assertEqual(result.return_code, 0)
Пример #11
0
    def test_positive_list(self):
        """List Content hosts for a given org

        @id: b9c056cd-11ca-4870-bac4-0ebc4a782cb0

        @Assert: Content hosts are listed for the given org

        @CaseLevel: System
        """
        activation_key = make_activation_key({
            'content-view-id':
            self.PROMOTED_CV['id'],
            'lifecycle-environment-id':
            self.NEW_LIFECYCLE['id'],
            'organization-id':
            self.NEW_ORG['id'],
        })
        with VirtualMachine(distro='rhel71') as client:
            client.install_katello_ca()
            client.register_contenthost(
                self.NEW_ORG['label'],
                activation_key['name'],
            )
            result = ContentHost.list({
                'organization-id':
                self.NEW_ORG['id'],
                'lifecycle-environment-id':
                self.NEW_LIFECYCLE['id'],
            })
            self.assertGreaterEqual(len(result), 1)
            self.assertIn(client.hostname, [chost['name'] for chost in result])
Пример #12
0
    def test_positive_delete_by_id(self):
        """Check if content host can be created and deleted

        @Feature: Content Hosts

        @Assert: Content host is created and then deleted

        """
        for name in generate_strings_list():
            with self.subTest(name):
                new_system = make_content_host({
                    u'content-view-id': self.DEFAULT_CV['id'],
                    u'lifecycle-environment-id': self.LIBRARY['id'],
                    u'name': name,
                    u'organization-id': self.NEW_ORG['id'],
                })
                ContentHost.delete({u'id': new_system['id']})
                with self.assertRaises(CLIReturnCodeError):
                    ContentHost.info({'id': new_system['id']})
Пример #13
0
    def test_positive_unregister(self):
        """Unregister Content host

        @id: c5ce988d-d0ea-4958-9956-5a4b039b285c

        @Assert: After unregistering, content hosts list for the org does not
        show the content host

        @CaseLevel: System
        """
        activation_key = make_activation_key({
            'content-view-id':
            self.PROMOTED_CV['id'],
            'lifecycle-environment-id':
            self.NEW_LIFECYCLE['id'],
            'organization-id':
            self.NEW_ORG['id'],
        })
        with VirtualMachine(distro=DISTRO_RHEL7) as client:
            client.install_katello_ca()
            client.register_contenthost(
                self.NEW_ORG['label'],
                activation_key['name'],
            )
            result = ContentHost.list({
                'organization-id':
                self.NEW_ORG['id'],
                'lifecycle-environment-id':
                self.NEW_LIFECYCLE['id'],
            })
            self.assertGreaterEqual(len(result), 1)
            self.assertIn(client.hostname, [chost['name'] for chost in result])
            result = client.run('subscription-manager unregister')
            self.assertEqual(result.return_code, 0)
            result = ContentHost.list({
                'organization-id':
                self.NEW_ORG['id'],
                'lifecycle-environment-id':
                self.NEW_LIFECYCLE['id'],
            })
            self.assertNotIn(client.hostname,
                             [chost['name'] for chost in result])
Пример #14
0
    def test_positive_update_description(self):
        """Check if content host description can be updated

        @Feature: Content Hosts

        @Assert: Content host is created and description is updated

        """
        new_system = make_content_host({
            u'content-view-id': self.DEFAULT_CV['id'],
            u'lifecycle-environment-id': self.LIBRARY['id'],
            u'organization-id': self.NEW_ORG['id'],
        })
        for new_desc in generate_strings_list():
            with self.subTest(new_desc):
                ContentHost.update({
                    u'id': new_system['id'],
                    u'description': new_desc,
                })
                result = ContentHost.info({'id': new_system['id']})
                self.assertEqual(result['description'], new_desc)
Пример #15
0
    def test_positive_delete_by_name(self):
        """Check if content host can be created and deleted by passing its name

        @id: 22f1206c-b712-45e9-8e65-3a0a225d6188

        @Assert: Content host is created and then deleted
        """
        for name in valid_hosts_list():
            with self.subTest(name):
                content_host = make_content_host({
                    u'content-view-id':
                    self.DEFAULT_CV['id'],
                    u'lifecycle-environment-id':
                    self.LIBRARY['id'],
                    u'name':
                    name,
                    u'organization-id':
                    self.NEW_ORG['id'],
                })
                ContentHost.delete({u'host': content_host['name']})
                with self.assertRaises(CLIReturnCodeError):
                    ContentHost.info({'id': content_host['id']})
Пример #16
0
 def transform_ids(cls, options=None):
     """Workaround host unification feature not being completed to use host
     id instead content host uuid
     """
     if 'host-ids' in options:
         host_ids = [
             host_id if host_id.isdigit() else Host.info({
                 'name':
                 ContentHost.info({'id': host_id})['name'].lower()
             })['id'] for host_id in options.get('host-ids').split(',')
         ]
         if host_ids:
             options['host-ids'] = ','.join(host_ids)
Пример #17
0
    def test_positive_delete_by_id(self):
        """Check if content host can be created and deleted by passing its ID

        @id: 1aa55e52-a97e-4c11-aab1-244bd4de0dd3

        @Assert: Content host is created and then deleted

        @BZ: 1328202
        """
        for name in valid_hosts_list():
            with self.subTest(name):
                content_host = make_content_host({
                    u'content-view-id':
                    self.DEFAULT_CV['id'],
                    u'lifecycle-environment-id':
                    self.LIBRARY['id'],
                    u'name':
                    name,
                    u'organization-id':
                    self.NEW_ORG['id'],
                })
                ContentHost.delete({u'host-id': content_host['id']})
                with self.assertRaises(CLIReturnCodeError):
                    ContentHost.info({'id': content_host['id']})
Пример #18
0
    def test_positive_end_to_end(self):
        """Perform end to end smoke tests using RH and custom repos.

        1. Create a new user with admin permissions
        2. Using the new user from above
            1. Create a new organization
            2. Clone and upload manifest
            3. Create a new lifecycle environment
            4. Create a custom product
            5. Create a custom YUM repository
            6. Create a custom PUPPET repository
            7. Enable a Red Hat repository
            8. Synchronize the three repositories
            9. Create a new content view
            10. Associate the YUM and Red Hat repositories to new content view
            11. Add a PUPPET module to new content view
            12. Publish content view
            13. Promote content view to the lifecycle environment
            14. Create a new activation key
            15. Add the products to the activation key
            16. Create a new libvirt compute resource
            17. Create a new subnet
            18. Create a new domain
            19. Create a new hostgroup and associate previous entities to it
            20. Provision a client

        @id: 8c8b3ffa-0d54-436b-8eeb-1a3542e100a8

        @Assert: All tests should succeed and Content should be successfully
        fetched by client.
        """
        # step 1: Create a new user with admin permissions
        password = gen_alphanumeric()
        user = make_user({u'admin': u'true', u'password': password})
        user['password'] = password

        # step 2.1: Create a new organization
        org = self._create(user, Org, {u'name': gen_alphanumeric()})

        # step 2.2: Clone and upload manifest
        if self.fake_manifest_is_set:
            with manifests.clone() as manifest:
                ssh.upload_file(manifest.content, manifest.filename)
            Subscription.upload({
                u'file': manifest.filename,
                u'organization-id': org['id'],
            })

        # step 2.3: Create a new lifecycle environment
        lifecycle_environment = self._create(
            user, LifecycleEnvironment, {
                u'name': gen_alphanumeric(),
                u'organization-id': org['id'],
                u'prior': u'Library',
            })

        # step 2.4: Create a custom product
        product = self._create(user, Product, {
            u'name': gen_alphanumeric(),
            u'organization-id': org['id'],
        })
        repositories = []

        # step 2.5: Create custom YUM repository
        yum_repo = self._create(
            user, Repository, {
                u'content-type': u'yum',
                u'name': gen_alphanumeric(),
                u'product-id': product['id'],
                u'publish-via-http': u'true',
                u'url': GOOGLE_CHROME_REPO,
            })
        repositories.append(yum_repo)

        # step 2.6: Create custom PUPPET repository
        puppet_repo = self._create(
            user, Repository, {
                u'content-type': u'puppet',
                u'name': gen_alphanumeric(),
                u'product-id': product['id'],
                u'publish-via-http': u'true',
                u'url': FAKE_0_PUPPET_REPO,
            })
        repositories.append(puppet_repo)

        # step 2.7: Enable a Red Hat repository
        if self.fake_manifest_is_set:
            RepositorySet.enable({
                u'basearch': 'x86_64',
                u'name': REPOSET['rhva6'],
                u'organization-id': org['id'],
                u'product': PRDS['rhel'],
                u'releasever': '6Server',
            })
            rhel_repo = Repository.info({
                u'name': REPOS['rhva6']['name'],
                u'organization-id': org['id'],
                u'product': PRDS['rhel'],
            })
            repositories.append(rhel_repo)

        # step 2.8: Synchronize the three repositories
        for repo in repositories:
            Repository.with_user(user['login'], user['password']).synchronize(
                {u'id': repo['id']})

        # step 2.9: Create content view
        content_view = self._create(user, ContentView, {
            u'name': gen_alphanumeric(),
            u'organization-id': org['id'],
        })

        # step 2.10: Associate the YUM and Red Hat repositories to new content
        # view
        repositories.remove(puppet_repo)
        for repo in repositories:
            ContentView.add_repository({
                u'id': content_view['id'],
                u'organization-id': org['id'],
                u'repository-id': repo['id'],
            })

        # step 2.11: Add a PUPPET module to new content view
        result = PuppetModule.with_user(user['login'], user['password']).list({
            u'repository-id':
            puppet_repo['id'],
            u'per-page':
            False,
        })
        ContentView.with_user(user['login'],
                              user['password']).puppet_module_add({
                                  u'content-view-id':
                                  content_view['id'],
                                  u'id':
                                  random.choice(result)['id'],
                              })

        # step 2.12: Publish content view
        ContentView.with_user(user['login'], user['password']).publish(
            {u'id': content_view['id']})

        # step 2.13: Promote content view to the lifecycle environment
        content_view = ContentView.with_user(
            user['login'], user['password']).info({u'id': content_view['id']})
        self.assertEqual(len(content_view['versions']), 1)
        cv_version = ContentView.with_user(
            user['login'], user['password']).version_info({
                'id':
                content_view['versions'][0]['id'],
            })
        self.assertEqual(len(cv_version['lifecycle-environments']), 1)
        ContentView.with_user(user['login'],
                              user['password']).version_promote({
                                  u'id':
                                  cv_version['id'],
                                  u'to-lifecycle-environment-id':
                                  lifecycle_environment['id'],
                              })
        # check that content view exists in lifecycle
        content_view = ContentView.with_user(
            user['login'], user['password']).info({u'id': content_view['id']})
        self.assertEqual(len(content_view['versions']), 1)
        cv_version = ContentView.with_user(
            user['login'], user['password']).version_info({
                'id':
                content_view['versions'][0]['id'],
            })
        self.assertEqual(len(cv_version['lifecycle-environments']), 2)
        self.assertEqual(cv_version['lifecycle-environments'][-1]['id'],
                         lifecycle_environment['id'])

        # step 2.14: Create a new activation key
        activation_key = self._create(
            user, ActivationKey, {
                u'content-view-id': content_view['id'],
                u'lifecycle-environment-id': lifecycle_environment['id'],
                u'name': gen_alphanumeric(),
                u'organization-id': org['id'],
            })

        # step 2.15: Add the products to the activation key
        subscription_list = Subscription.with_user(
            user['login'],
            user['password']).list({u'organization-id': org['id']},
                                   per_page=False)
        for subscription in subscription_list:
            if subscription['name'] == DEFAULT_SUBSCRIPTION_NAME:
                ActivationKey.with_user(user['login'],
                                        user['password']).add_subscription({
                                            u'id':
                                            activation_key['id'],
                                            u'quantity':
                                            1,
                                            u'subscription-id':
                                            subscription['id'],
                                        })

        # step 2.15.1: Enable product content
        if self.fake_manifest_is_set:
            ActivationKey.with_user(user['login'],
                                    user['password']).content_override({
                                        u'content-label':
                                        AK_CONTENT_LABEL,
                                        u'id':
                                        activation_key['id'],
                                        u'organization-id':
                                        org['id'],
                                        u'value':
                                        '1',
                                    })

        # BONUS: Create a content host and associate it with promoted
        # content view and last lifecycle where it exists
        content_host_name = gen_alphanumeric()
        content_host = Host.with_user(user['login'],
                                      user['password']).subscription_register({
                                          u'content-view-id':
                                          content_view['id'],
                                          u'lifecycle-environment-id':
                                          lifecycle_environment['id'],
                                          u'name':
                                          content_host_name,
                                          u'organization-id':
                                          org['id'],
                                      })
        if bz_bug_is_open(1328202):
            results = ContentHost.with_user(user['login'],
                                            user['password']).list(
                                                {'organization-id': org['id']})
            # Content host registration converts the name to lowercase, make
            # sure to use the same format while matching against the result
            content_host_name = content_host_name.lower()
            for result in results:
                if result['name'] == content_host_name:
                    content_host = result
        content_host = ContentHost.with_user(
            user['login'], user['password']).info({'id': content_host['id']})
        # check that content view matches what we passed
        self.assertEqual(content_host['content-view'], content_view['name'])
        # check that lifecycle environment matches
        self.assertEqual(content_host['lifecycle-environment'],
                         lifecycle_environment['name'])

        # step 2.16: Create a new libvirt compute resource
        self._create(
            user, ComputeResource, {
                u'name':
                gen_alphanumeric(),
                u'provider':
                u'Libvirt',
                u'url':
                u'qemu+ssh://root@{0}/system'.format(
                    settings.compute_resources.libvirt_hostname),
            })

        # step 2.17: Create a new subnet
        subnet = self._create(
            user, Subnet, {
                u'name': gen_alphanumeric(),
                u'network': gen_ipaddr(ip3=True),
                u'mask': u'255.255.255.0',
            })

        # step 2.18: Create a new domain
        domain = self._create(user, Domain, {u'name': gen_alphanumeric()})

        # step 2.19: Create a new hostgroup and associate previous entities to
        # it
        host_group = self._create(
            user, HostGroup, {
                u'domain-id': domain['id'],
                u'name': gen_alphanumeric(),
                u'subnet-id': subnet['id'],
            })
        if not bz_bug_is_open('1326101'):
            Org.with_user(user['login'], user['password']).add_hostgroup({
                u'hostgroup-id':
                host_group['id'],
                u'id':
                org['id'],
            })

        # step 2.20: Provision a client
        self.client_provisioning(activation_key['name'], org['label'])