Exemplo n.º 1
0
    def test_positive_create_with_same_name(self):
        """Registering the same content host generates a new UUID.

        @id: 178d3570-7177-435b-96e9-bcbb6b0b63b3

        @Assert: The UUID generated is different when registering the same
        content host.
        """
        name = gen_string('alpha', 15).lower()
        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'],
        })
        self.assertEqual(content_host['name'], name)
        result = 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'],
        })
        self.assertEqual(result['name'], name)
        self.assertEqual(result['lifecycle-environment'], self.LIBRARY['name'])
        self.assertEqual(result['content-view'], self.DEFAULT_CV['name'])
        self.assertNotEqual(result['id'], content_host['id'])
Exemplo n.º 2
0
    def test_negative_create_with_same_name(self):
        """check if Content Host creation does not allow duplicated
        names

        @feature: Contet_Hosts

        @assert: Content Hosts with the same name are not allowed

        @bz: 1154611

        """
        name = gen_string('alpha', 15)
        result = 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'],
        })
        self.assertEqual(result['name'], name)
        with self.assertRaises(CLIFactoryError):
            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'],
            })
Exemplo n.º 3
0
    def test_positive_create_with_same_name(self):
        """Registering the same content host generates a new UUID.

        @id: 178d3570-7177-435b-96e9-bcbb6b0b63b3

        @Assert: The UUID generated is different when registering the same
        content host.
        """
        name = gen_string('alpha', 15).lower()
        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'],
        })
        self.assertEqual(content_host['name'], name)
        result = 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'],
        })
        self.assertEqual(result['name'], name)
        self.assertEqual(result['lifecycle-environment'], self.LIBRARY['name'])
        self.assertEqual(result['content-view'], self.DEFAULT_CV['name'])
        self.assertNotEqual(result['id'], content_host['id'])
Exemplo n.º 4
0
    def test_bugzilla_1154611(self):
        """@test: check if Content Host creation does not allow duplicated
        names

        @feature: Contet_Hosts

        @assert: Content Hosts with the same name are not allowed

        @bz: 1154611

        """
        name = gen_string("alpha", 15)
        result = 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"],
            }
        )
        self.assertEqual(result["name"], name)
        with self.assertRaises(CLIFactoryError):
            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"],
                }
            )
Exemplo n.º 5
0
    def test_negative_create_1(self, test_data):
        """
        @Test: Check if content host can be created with random long names
        @Feature: Content Hosts
        @Assert: Content host is not created
        """

        with self.assertRaises(Exception):
            make_content_host({
                u'name': test_data['name'],
                u'organization-id': self.NEW_ORG['id'],
                u'content-view-id': self.DEFAULT_CV['id'],
                u'environment-id': self.LIBRARY['id']})
Exemplo n.º 6
0
    def test_negative_create_1(self, test_data):
        """
        @Test: Check if content host can be created with random long names
        @Feature: Content Hosts
        @Assert: Content host is not created
        """

        with self.assertRaises(Exception):
            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']})
Exemplo n.º 7
0
    def test_add_content_host(self):
        """@Test: Check if content host can be added to host collection

        @Feature: Host Collection

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

        """
        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-content-hosts']
        HostCollection.add_content_host({
            u'content-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-content-hosts'], no_of_content_host)
Exemplo n.º 8
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 = 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)
        result = HostCollection.hosts({
            u'name': host_col_name,
            u'organization-id': self.org['id']
        })
        self.assertEqual(new_system['name'].lower(), result[0]['name'])
Exemplo n.º 9
0
    def test_positive_create_4(self):
        """@Test: Check if content host can be created with organization label

        @Feature: Content Hosts

        @Assert: Content host is created using organization label

        """

        new_system = make_content_host({
            u'name':
            gen_string('alpha', 15),
            u'organization-label':
            self.NEW_ORG['label'],
            u'content-view-id':
            self.DEFAULT_CV['id'],
            u'lifecycle-environment-id':
            self.LIBRARY['id'],
        })
        # Info does not tell us information about the organization so
        # let's assert that content view and environments match instead
        self.assertEqual(new_system['content-view'], self.DEFAULT_CV['name'],
                         "Content views don't match")
        self.assertEqual(new_system['lifecycle-environment'],
                         self.LIBRARY['name'], "Environments don't match")
Exemplo n.º 10
0
    def test_positive_create_with_cv(self):
        """Check if content host can be created with new content view

        @id: f90873b9-fb3a-4c93-8647-4b1aea0a2c35

        @Assert: Content host is created using new published, promoted cv
        """
        if ContentHostTestCase.PROMOTED_CV is None:
            self.fail("Couldn't prepare promoted contentview for this test")

        new_system = make_content_host({
            u'content-view-id':
            ContentHostTestCase.PROMOTED_CV['id'],
            u'lifecycle-environment-id':
            ContentHostTestCase.NEW_LIFECYCLE['id'],
            u'name':
            gen_string('alpha', 15),
            u'organization-id':
            ContentHostTestCase.NEW_ORG['id'],
        })
        # Assert that content views matches data passed
        self.assertEqual(
            new_system['content-view'],
            ContentHostTestCase.PROMOTED_CV['name'],
        )
Exemplo n.º 11
0
    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)
Exemplo n.º 12
0
    def test_negative_create_with_name(self):
        """Check if content host can be created with random long names

        @id: f92b6070-b2d1-4e3e-975c-39f1b1096697

        @Assert: Content host is not created
        """
        for name in invalid_values_list():
            with self.subTest(name):
                with self.assertRaises(CLIFactoryError):
                    make_content_host({
                        u'name': name,
                        u'organization-id': self.NEW_ORG['id'],
                        u'content-view-id': self.DEFAULT_CV['id'],
                        u'lifecycle-environment-id': self.LIBRARY['id'],
                    })
Exemplo n.º 13
0
    def test_positive_add_host(self):
        """Check if host can be added to Host Collection

        @id: 80824c9f-15a1-4f76-b7ac-7d9ca9f6ed9e

        @Assert: Host is added to Host Collection successfully

        @CaseLevel: System
        """
        name = gen_string('alpha')
        cv = entities.ContentView(organization=self.organization).create()
        lce = entities.LifecycleEnvironment(
            organization=self.organization).create()
        cv.publish()
        promote(cv.read().version[0], lce.id)
        new_system = make_content_host({
            u'content-view-id':
            cv.id,
            u'lifecycle-environment-id':
            lce.id,
            u'name':
            gen_string('alpha'),
            u'organization-id':
            self.organization.id,
        })
        with Session(self.browser) as session:
            make_host_collection(session,
                                 org=self.organization.name,
                                 name=name)
            self.hostcollection.add_host(name, new_system['name'])
Exemplo n.º 14
0
    def test_remove_content_host(self):
        """@Test: Check if content host can be removed from host collection

        @Feature: Host Collection

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

        """

        host_col_name = generate_string('alpha', 15)
        content_host_name = generate_string('alpha', 15)

        try:
            new_host_col = self._new_host_collection({'name': host_col_name})
            new_system = make_content_host({
                u'name': content_host_name,
                u'organization-id': self.org['id'],
                u'content-view-id': self.default_cv['id'],
                u'lifecycle-environment-id': self.library['id']})
        except CLIFactoryError as err:
            self.fail(err)

        result = HostCollection.add_content_host({
            u'id': new_host_col['id'],
            u'organization-id': self.org['id'],
            u'content-host-ids': new_system['id']
        })
        self.assertEqual(result.return_code, 0,
                         "Content Host not added to host collection")
        self.assertEqual(len(result.stderr), 0,
                         "No error was expected")

        result = HostCollection.info({
            u'id': new_host_col['id'],
            u'organization-id': self.org['id']
        })

        no_of_content_host = result.stdout['total-content-hosts']

        result = HostCollection.remove_content_host({
            u'id': new_host_col['id'],
            u'organization-id': self.org['id'],
            u'content-host-ids': new_system['id']
        })
        self.assertEqual(result.return_code, 0,
                         "Content Host not removed host collection")
        self.assertEqual(len(result.stderr), 0,
                         "No error was expected")

        result = HostCollection.info({
            u'id': new_host_col['id'],
            u'organization-id': self.org['id']
        })
        self.assertEqual(
            result.return_code, 0, 'Failed to get info for host collection')
        self.assertEqual(
            len(result.stderr), 0, 'There should not be an error here')
        self.assertGreater(no_of_content_host,
                           result.stdout['total-content-hosts'],
                           "There should not be an exception here")
Exemplo n.º 15
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")
Exemplo n.º 16
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'])
Exemplo n.º 17
0
    def test_positive_create_8(self):
        """@Test: Check if content host can be created with new content view

        @Feature: Content Hosts

        @Assert: Content host is created using new published, promoted cv

        """

        if TestContentHost.PROMOTED_CV is None:
            self.fail("Couldn't prepare promoted contentview for this test")

        new_system = make_content_host({
            u'name':
            gen_string('alpha', 15),
            u'organization-id':
            TestContentHost.NEW_ORG['id'],
            u'content-view-id':
            TestContentHost.PROMOTED_CV['id'],
            u'lifecycle-environment-id':
            TestContentHost.NEW_LIFECYCLE['id'],
        })
        # Assert that content views matches data passed
        self.assertEqual(new_system['content-view'],
                         TestContentHost.PROMOTED_CV['name'],
                         "Content Views don't match")
Exemplo n.º 18
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'])
Exemplo n.º 19
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_content_host(
            {u"content-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-content-hosts"
        ]
        HostCollection.remove_content_host(
            {u"content-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-content-hosts"])
Exemplo n.º 20
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)
Exemplo n.º 21
0
    def test_positive_add_host(self):
        """Check if host can be added to Host Collection

        @id: 80824c9f-15a1-4f76-b7ac-7d9ca9f6ed9e

        @Assert: Host is added to Host Collection successfully

        @CaseLevel: System
        """
        name = gen_string('alpha')
        cv = entities.ContentView(organization=self.organization).create()
        lce = entities.LifecycleEnvironment(
            organization=self.organization).create()
        cv.publish()
        promote(cv.read().version[0], lce.id)
        new_system = make_content_host({
            u'content-view-id': cv.id,
            u'lifecycle-environment-id': lce.id,
            u'name': gen_string('alpha'),
            u'organization-id': self.organization.id,
        })
        with Session(self.browser) as session:
            make_host_collection(
                session, org=self.organization.name, name=name)
            self.hostcollection.add_host(name, new_system['name'])
Exemplo n.º 22
0
    def test_positive_list_chosts(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-content-hosts"]
        HostCollection.add_content_host(
            {u"content-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-content-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"])
Exemplo n.º 23
0
    def test_positive_create_4(self):
        """@Test: Check if content host can be created with organization label

        @Feature: Content Hosts

        @Assert: Content host is created using organization label

        """

        new_system = make_content_host({
            u'name': gen_string('alpha', 15),
            u'organization-label': self.NEW_ORG['label'],
            u'content-view-id': self.DEFAULT_CV['id'],
            u'lifecycle-environment-id': self.LIBRARY['id'],
        })
        # Info does not tell us information about the organization so
        # let's assert that content view and environments match instead
        self.assertEqual(
            new_system['content-view'],
            self.DEFAULT_CV['name'],
            "Content views don't match")
        self.assertEqual(
            new_system['lifecycle-environment'],
            self.LIBRARY['name'],
            "Environments don't match")
Exemplo n.º 24
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"
        )
Exemplo n.º 25
0
    def test_negative_create_2(self):
        """
        @Test: Check if content host can be created with new content view
        @Feature: Content Hosts
        @Assert: Content host is not created using new unpublished cv
        """

        con_view = make_content_view(
            {u'organization-id': TestContentHost.NEW_ORG['id']}
        )
        with self.assertRaises(Exception):
            env = TestContentHost.NEW_LIFECYCLE['id']
            make_content_host({
                u'name': generate_string('alpha', 15),
                u'organization-id': TestContentHost.NEW_ORG['id'],
                u'content-view-id': con_view['id'],
                u'lifecycle-environment-id': env})
Exemplo n.º 26
0
 def _make_content_host_helper(self):
     """Make a new content host"""
     return 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'],
     })
Exemplo n.º 27
0
    def test_negative_create_with_name(self):
        """Check if content host can be created with random long names

        @Feature: Content Hosts

        @Assert: Content host is not created

        """
        for name in invalid_values_list():
            with self.subTest(name):
                with self.assertRaises(CLIFactoryError):
                    make_content_host({
                        u'name': name,
                        u'organization-id': self.NEW_ORG['id'],
                        u'content-view-id': self.DEFAULT_CV['id'],
                        u'lifecycle-environment-id': self.LIBRARY['id'],
                    })
Exemplo n.º 28
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"
        )
Exemplo n.º 29
0
    def test_add_content_host(self):
        """@Test: Check if content host can be added to host collection

        @Feature: Host Collection

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

        """

        host_col_name = gen_string('alpha', 15)
        content_host_name = gen_string('alpha', 15)

        try:
            new_host_col = self._new_host_collection({'name': host_col_name})
            new_system = make_content_host({
                u'name':
                content_host_name,
                u'organization-id':
                self.org['id'],
                u'content-view-id':
                self.default_cv['id'],
                u'lifecycle-environment-id':
                self.library['id'],
            })
        except CLIFactoryError as err:
            self.fail(err)

        result = HostCollection.info({
            u'id': new_host_col['id'],
            u'organization-id': self.org['id']
        })

        no_of_content_host = result.stdout['total-content-hosts']

        result = HostCollection.add_content_host({
            u'id':
            new_host_col['id'],
            u'organization-id':
            self.org['id'],
            u'content-host-ids':
            new_system['id']
        })
        self.assertEqual(result.return_code, 0,
                         "Content Host not added to host collection")
        self.assertEqual(len(result.stderr), 0, "No error was expected")

        result = HostCollection.info({
            u'id': new_host_col['id'],
            u'organization-id': self.org['id']
        })
        self.assertEqual(result.return_code, 0,
                         'Failed to get info for host collection')
        self.assertEqual(len(result.stderr), 0,
                         'There should not be an error here')
        self.assertGreater(result.stdout['total-content-hosts'],
                           no_of_content_host,
                           "There should not be an exception here")
Exemplo n.º 30
0
    def test_negative_create_with_unpublished_cv(self):
        """Check if content host can be created using unpublished cv

        @id: 9997383d-3c27-4f14-94f9-4b8b51180eb6

        @Assert: Content host is not created using new unpublished cv
        """
        cv = make_content_view({
            u'organization-id': ContentHostTestCase.NEW_ORG['id'],
        })
        env = ContentHostTestCase.NEW_LIFECYCLE['id']
        with self.assertRaises(CLIFactoryError):
            make_content_host({
                u'content-view-id': cv['id'],
                u'lifecycle-environment-id': env,
                u'name': gen_string('alpha', 15),
                u'organization-id': ContentHostTestCase.NEW_ORG['id'],
            })
Exemplo n.º 31
0
    def test_negative_create_2(self):
        """@Test: Check if content host can be created with new content view

        @Feature: Content Hosts

        @Assert: Content host is not created using new unpublished cv

        """

        con_view = make_content_view(
            {u'organization-id': TestContentHost.NEW_ORG['id']})
        with self.assertRaises(Exception):
            env = TestContentHost.NEW_LIFECYCLE['id']
            make_content_host({
                u'name': gen_string('alpha', 15),
                u'organization-id': TestContentHost.NEW_ORG['id'],
                u'content-view-id': con_view['id'],
                u'lifecycle-environment-id': env
            })
Exemplo n.º 32
0
    def test_negative_create_with_name(self):
        """Check if content host can be created with random long names

        @Feature: Content Hosts

        @Assert: Content host is not created

        """
        for name in invalid_values_list():
            with self.subTest(name):
                with self.assertRaises(CLIFactoryError):
                    make_content_host(
                        {
                            u"name": name,
                            u"organization-id": self.NEW_ORG["id"],
                            u"content-view-id": self.DEFAULT_CV["id"],
                            u"lifecycle-environment-id": self.LIBRARY["id"],
                        }
                    )
Exemplo n.º 33
0
    def test_negative_create_with_unpublished_cv(self):
        """Check if content host can be created using unpublished cv

        @Feature: Content Hosts

        @Assert: Content host is not created using new unpublished cv

        """
        con_view = make_content_view({
            u'organization-id': ContentHostTestCase.NEW_ORG['id'],
        })
        env = ContentHostTestCase.NEW_LIFECYCLE['id']
        with self.assertRaises(CLIFactoryError):
            make_content_host({
                u'content-view-id': con_view['id'],
                u'lifecycle-environment-id': env,
                u'name': gen_string('alpha', 15),
                u'organization-id': ContentHostTestCase.NEW_ORG['id'],
            })
Exemplo n.º 34
0
    def test_negative_create_with_unpublished_cv(self):
        """@Test: Check if content host can be created using unpublished cv

        @Feature: Content Hosts

        @Assert: Content host is not created using new unpublished cv

        """
        con_view = make_content_view({
            u'organization-id': ContentHostTestCase.NEW_ORG['id'],
        })
        env = ContentHostTestCase.NEW_LIFECYCLE['id']
        with self.assertRaises(CLIFactoryError):
            make_content_host({
                u'content-view-id': con_view['id'],
                u'lifecycle-environment-id': env,
                u'name': gen_string('alpha', 15),
                u'organization-id': ContentHostTestCase.NEW_ORG['id'],
            })
Exemplo n.º 35
0
    def test_negative_create_with_unpublished_cv(self):
        """Check if content host can be created using unpublished cv

        @Feature: Content Hosts

        @Assert: Content host is not created using new unpublished cv

        """
        con_view = make_content_view({u"organization-id": ContentHostTestCase.NEW_ORG["id"]})
        env = ContentHostTestCase.NEW_LIFECYCLE["id"]
        with self.assertRaises(CLIFactoryError):
            make_content_host(
                {
                    u"content-view-id": con_view["id"],
                    u"lifecycle-environment-id": env,
                    u"name": gen_string("alpha", 15),
                    u"organization-id": ContentHostTestCase.NEW_ORG["id"],
                }
            )
Exemplo n.º 36
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"
        )
Exemplo n.º 37
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"
        )
Exemplo n.º 38
0
    def test_positive_create_with_cv_default(self):
        """Check if content host can be created with content view name

        @id: bb69a70e-17f9-4639-802d-90e6a4520afa

        @Assert: Content host is created using content view name
        """
        new_system = make_content_host({
            u'content-view': self.DEFAULT_CV['name'],
            u'lifecycle-environment-id': self.LIBRARY['id'],
            u'name': gen_string('alpha', 15),
            u'organization-id': self.NEW_ORG['id'],
        })
        # Assert that name matches data passed
        self.assertEqual(new_system['content-view'], self.DEFAULT_CV['name'])
Exemplo n.º 39
0
    def test_positive_create_with_cv_default(self):
        """Check if content host can be created with content view name

        @Feature: Content Hosts

        @Assert: Content host is created using content view name

        """
        new_system = make_content_host({
            u'content-view': self.DEFAULT_CV['name'],
            u'lifecycle-environment-id': self.LIBRARY['id'],
            u'name': gen_string('alpha', 15),
            u'organization-id': self.NEW_ORG['id'],
        })
        # Assert that name matches data passed
        self.assertEqual(new_system['content-view'], self.DEFAULT_CV['name'])
Exemplo n.º 40
0
    def test_content_hosts(self):
        """@Test: 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)
        content_host_name = gen_string('alpha', 15)

        try:
            new_host_col = self._new_host_collection({'name': host_col_name})
            new_system = make_content_host({
                u'name': content_host_name,
                u'organization-id': self.org['id'],
                u'content-view-id': self.default_cv['id'],
                u'lifecycle-environment-id': self.library['id'],
            })
        except CLIFactoryError as err:
            self.fail(err)
        no_of_content_host = new_host_col['total-content-hosts']
        result = HostCollection.add_content_host({
            u'id': new_host_col['id'],
            u'organization-id': self.org['id'],
            u'content-host-ids': new_system['id']
        })
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        result = HostCollection.info({
            u'id': new_host_col['id'],
            u'organization-id': self.org['id']
        })
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
        self.assertGreater(
            result.stdout['total-content-hosts'], no_of_content_host)

        result = HostCollection.content_hosts({
            u'name': host_col_name,
            u'organization-id': self.org['id']
        })
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
        self.assertEqual(new_system['id'], result.stdout[0]['id'])
Exemplo n.º 41
0
    def test_positive_create_with_name(self):
        """Check if content host can be created with random names

        @id: ad2b1b03-68a1-49c8-9523-4164fcd7ee14

        @Assert: Content host is created and has random name
        """
        for name in valid_hosts_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'],
                })
            # Assert that name matches data passed
            self.assertEqual(new_system['name'], name)
Exemplo n.º 42
0
    def test_positive_create_7(self):
        """
        @Test: Check if content host can be created with new lifecycle
        @Feature: Content Hosts
        @Assert: Content host is created using new lifecycle
        """

        new_system = make_content_host({
            u'name': generate_string('alpha', 15),
            u'organization-id': self.NEW_ORG['id'],
            u'content-view-id': self.DEFAULT_CV['id'],
            u'environment-id': self.NEW_LIFECYCLE['id']})
        # Assert that content views matches data passed
        self.assertEqual(
            new_system['lifecycle-environment'],
            self.NEW_LIFECYCLE['name'],
            "Environments don't match"
        )
Exemplo n.º 43
0
    def test_positive_create_2(self, test_data):
        """
        @Test: Check if content host can be created with random description
        @Feature: Content Hosts
        @Assert: Content host is created and has random description
        """

        new_system = make_content_host({
            u'description': test_data['description'],
            u'organization-id': self.NEW_ORG['id'],
            u'content-view-id': self.DEFAULT_CV['id'],
            u'environment-id': self.LIBRARY['id']})
        # Assert that description matches data passed
        self.assertEqual(
            new_system['description'],
            test_data['description'],
            "Descriptions don't match"
        )
Exemplo n.º 44
0
    def test_positive_create_with_name(self):
        """Check if content host can be created with random names

        @Feature: Content Hosts

        @Assert: Content host is created and has random name

        """
        for name in generate_strings_list(15):
            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'],
                })
            # Assert that name matches data passed
            self.assertEqual(new_system['name'], name)
Exemplo n.º 45
0
    def test_positive_create_with_description(self):
        """Check if content host can be created with random description

        @Feature: Content Hosts

        @Assert: Content host is created and has random description

        """
        for desc in generate_strings_list(15):
            with self.subTest(desc):
                new_system = make_content_host({
                    u'description': desc,
                    u'content-view-id': self.DEFAULT_CV['id'],
                    u'lifecycle-environment-id': self.LIBRARY['id'],
                    u'organization-id': self.NEW_ORG['id'],
                })
                # Assert that description matches data passed
                self.assertEqual(new_system['description'], desc)
Exemplo n.º 46
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']})
Exemplo n.º 47
0
    def test_positive_create_with_lce(self):
        """Check if content host can be created with new lifecycle

        @id: e102b034-0011-471d-ba21-5ef8d129a61f

        @Assert: Content host is created using new lifecycle
        """
        new_system = make_content_host({
            u'content-view-id': self.PROMOTED_CV['id'],
            u'lifecycle-environment-id': self.NEW_LIFECYCLE['id'],
            u'name': gen_string('alpha', 15),
            u'organization-id': self.NEW_ORG['id'],
        })
        # Assert that content views matches data passed
        self.assertEqual(
            new_system['lifecycle-environment'],
            self.NEW_LIFECYCLE['name'],
        )
Exemplo n.º 48
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']})
Exemplo n.º 49
0
    def test_negative_content_hosts_limit(self):
        """Check that Content Host limit actually limits usage

        @Feature: Host Collection - Content Host Limit

        @Steps:
        1. Create Host Collection entity that can contain only one Content Host
        (using Content Host Limit field)
        2. Create Content Host and add it to Host Collection. Check that it
        added successfully
        3. Create one more Content Host and try to add it to Host Collection
        4. Check that expected error is shown

        @Assert: Second content host is not added to Host Collection and
        appropriate error is shown
        """
        name = gen_string('alpha')
        cv = entities.ContentView(organization=self.organization).create()
        lce = entities.LifecycleEnvironment(
            organization=self.organization).create()
        cv.publish()
        promote(cv.read().version[0], lce.id)
        new_systems = [
            make_content_host({
                u'content-view-id': cv.id,
                u'lifecycle-environment-id': lce.id,
                u'name': gen_string('alpha'),
                u'organization-id': self.organization.id,
            })['name'] for _ in range(2)
        ]
        with Session(self.browser) as session:
            make_host_collection(session,
                                 org=self.organization.name,
                                 name=name,
                                 limit='1')
            self.hostcollection.add_content_host(name, new_systems[0])
            with self.assertRaises(UIError):
                self.hostcollection.add_content_host(name, new_systems[1])
            self.assertIsNotNone(
                self.hostcollection.wait_until_element(
                    common_locators['alert.error_sub_form']))
Exemplo n.º 50
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)
Exemplo n.º 51
0
    def test_positive_create_with_name(self):
        """Check if content host can be created with random names

        @id: ad2b1b03-68a1-49c8-9523-4164fcd7ee14

        @Assert: Content host is created and has random name
        """
        for name in valid_hosts_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'],
                })
            # Assert that name matches data passed
            self.assertEqual(new_system['name'], name)
Exemplo n.º 52
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']})
Exemplo n.º 53
0
    def test_positive_create_1(self, test_data):
        """@Test: Check if content host can be created with random names

        @Feature: Content Hosts

        @Assert: Content host is created and has random name

        """

        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")
Exemplo n.º 54
0
    def test_positive_create_8(self):
        """
        @Test: Check if content host can be created with new content view
        @Feature: Content Hosts
        @Assert: Content host is created using new content view
        """

        # Make a new content view
        new_cv = make_content_view({
            u'organization-id': self.NEW_ORG['id']})

        new_system = make_content_host({
            u'name': generate_string('alpha', 15),
            u'organization-id': self.NEW_ORG['id'],
            u'content-view-id': new_cv['id'],
            u'environment-id': self.LIBRARY['id']})
        # Assert that content views matches data passed
        self.assertEqual(
            new_system['content-view'],
            new_cv['name'],
            "Content Views don't match"
        )