示例#1
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)
示例#2
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")
    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"
        )
    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"
        )
示例#5
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']})
    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']})
示例#7
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"
        )
示例#8
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']})
示例#9
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"
        )
示例#10
0
    def test_positive_delete_1(self):
        """@Test: 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"]})
示例#11
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)
示例#12
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']})
示例#13
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)
示例#14
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']})
    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"
        )
示例#16
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)
    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)
    def test_positive_update_name(self):
        """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'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 generate_strings_list():
            with self.subTest(new_name):
                ContentHost.update({
                    u'id': new_system['id'],
                    u'name': new_name,
                })
                result = ContentHost.info({'id': new_system['id']})
                self.assertEqual(result['name'], new_name)
示例#19
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)