Esempio n. 1
0
    def test_positive_update_registry_name_pattern(self):
        """Create lifecycle environment and then update registry name pattern

        :id: 131aaed7-d74f-4c9a-be7e-04226d48e64a

        :expectedresults: Lifecycle environment registry name pattern is updated


        :CaseImportance: Critical
        """
        lce = make_lifecycle_environment({'organization-id': self.org['id']})
        registry_name_pattern = (
            "{}-<%= organization.label %>/<%= repository.docker_upstream_name %>"
        ).format(gen_string('alpha', 5))

        LifecycleEnvironment.update({
            'registry-name-pattern': registry_name_pattern,
            'id': lce['id'],
            'organization-id': self.org['id'],
        })
        result = LifecycleEnvironment.info({
            'id': lce['id'],
            'organization-id': self.org['id']
        })
        self.assertGreater(len(result), 0)
        self.assertEqual(result['registry-name-pattern'],
                         registry_name_pattern)
    def test_positive_update_description(self):
        """Create lifecycle environment then update its description

        :id: 15b82949-3c3a-4942-b42b-db1de34cf5be

        :expectedresults: Lifecycle environment description is updated


        :CaseImportance: Critical
        """
        new_lce = make_lifecycle_environment({
            'organization-id': self.org['id'],
        })
        for new_desc in valid_data_list():
            with self.subTest(new_desc):
                LifecycleEnvironment.update({
                    'description': new_desc,
                    'id': new_lce['id'],
                    'organization-id': self.org['id'],
                })
                result = LifecycleEnvironment.info({
                    'id': new_lce['id'],
                    'organization-id': self.org['id'],
                })
                self.assertGreater(len(result), 0)
                self.assertEqual(result['description'], new_desc)
    def test_positive_list_with_pagination(self):
        """Make sure lces list can be displayed with different items per page
        value

        :id: 28ecbc1f-bb5c-49df-a586-8cfdc0dd57df

        :BZ: 1368590

        :expectedresults: `per-page` correctly sets amount of items displayed
            per page, different `per-page` values divide a list into correct
            number of pages

        :CaseImportance: Critical
        """
        # Test different `per-page` values
        for per_page in (1, 5, 20):
            with self.subTest(per_page):
                # Verify the first page contains exactly the same items count
                # as `per-page` value
                lces = LifecycleEnvironment.list({
                    'organization-id': self.org['id'],
                    'per-page': per_page,
                })
                self.assertEqual(len(lces), per_page)
                # Verify pagination and total amount of pages by checking the
                # items count on the last page
                last_page = (self.lces_count / per_page
                             + int(self.lces_count % per_page != 0))
                lces = LifecycleEnvironment.list({
                    'organization-id': self.org['id'],
                    'page': last_page,
                    'per-page': per_page,
                })
                self.assertEqual(
                    len(lces), self.lces_count % per_page or per_page)
    def test_positive_update_2(self, test_data):
        """@Test: Create lifecycle environment then update its description

        @Feature: Lifecycle Environment

        @Assert: Lifecycle environment description is updated

        """
        new_obj = make_lifecycle_environment({
            'organization-id': self.org['id'],
        })

        # Update its description
        result = LifecycleEnvironment.update({
            'description': test_data['description'],
            'id': new_obj['id'],
            'organization-id': self.org['id'],
            'prior': new_obj['prior-lifecycle-environment'],
        })
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        # Fetch the object
        result = LifecycleEnvironment.info({
            'id': new_obj['id'],
            'organization-id': self.org['id'],
        })
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
        self.assertGreater(len(result.stdout), 0)
        self.assertEqual(
            test_data['description'], result.stdout['description'])
        self.assertNotEqual(
            new_obj['description'], result.stdout['description'])
Esempio n. 5
0
    def test_positive_update_2(self, test_data):
        """
        @Test: Create lifecycle environment then update its description
        @Feature: Lifecycle Environment
        @Assert: Lifecycle environment description is updated
        """

        payload = {"organization-id": self.org["label"]}

        new_obj = make_lifecycle_environment(payload)
        self.assertIsNotNone(new_obj, "Could not create lifecycle environment.")

        # Update its description
        result = LifecycleEnvironment.update(
            {"organization-id": self.org["label"], "id": new_obj["id"], "description": test_data["description"]}
        )
        self.assertEqual(result.return_code, 0, "Could find the lifecycle environment")
        self.assertEqual(len(result.stderr), 0, "There should not be an error here.")

        # Fetch the object
        result = LifecycleEnvironment.info({"organization-id": self.org["label"], "id": new_obj["id"]})
        self.assertEqual(result.return_code, 0, "Could find the lifecycle environment")
        self.assertEqual(len(result.stderr), 0, "There should not be an error here.")
        self.assertGreater(len(result.stdout), 0, "No output was returned")
        self.assertEqual(test_data["description"], result.stdout["description"], "Description was not updated")
        self.assertNotEqual(
            new_obj["description"], result.stdout["description"], "Description should have been updated"
        )
    def test_positive_delete_by_id(self):
        """Create lifecycle environment with valid name, prior to
        Library

        @Feature: Lifecycle Environment

        @Assert: Lifecycle environment is deleted

        """
        for name in valid_data_list():
            with self.subTest(name):
                new_lce = make_lifecycle_environment({
                    'name':
                    name,
                    'organization-id':
                    self.org['id'],
                })
                LifecycleEnvironment.delete({'id': new_lce['id']})
                with self.assertRaises(CLIReturnCodeError):
                    LifecycleEnvironment.info({
                        'id':
                        new_lce['id'],
                        'organization-id':
                        self.org['id'],
                    })
    def test_positive_update_description(self):
        """Create lifecycle environment then update its description

        @Feature: Lifecycle Environment

        @Assert: Lifecycle environment description is updated

        """
        new_lce = make_lifecycle_environment({
            'organization-id': self.org['id'],
        })
        for new_desc in valid_data_list():
            with self.subTest(new_desc):
                LifecycleEnvironment.update({
                    'description':
                    new_desc,
                    'id':
                    new_lce['id'],
                    'organization-id':
                    self.org['id'],
                    'prior':
                    new_lce['prior-lifecycle-environment'],
                })
                result = LifecycleEnvironment.info({
                    'id':
                    new_lce['id'],
                    'organization-id':
                    self.org['id'],
                })
                self.assertGreater(len(result), 0)
                self.assertEqual(result['description'], new_desc)
Esempio n. 8
0
    def test_positive_update_description(self):
        """Create lifecycle environment then update its description

        :id: 15b82949-3c3a-4942-b42b-db1de34cf5be

        :expectedresults: Lifecycle environment description is updated


        :CaseImportance: Critical
        """
        new_lce = make_lifecycle_environment(
            {'organization-id': self.org['id']})
        for new_desc in valid_data_list():
            with self.subTest(new_desc):
                LifecycleEnvironment.update({
                    'description': new_desc,
                    'id': new_lce['id'],
                    'organization-id': self.org['id'],
                })
                result = LifecycleEnvironment.info({
                    'id':
                    new_lce['id'],
                    'organization-id':
                    self.org['id']
                })
                self.assertGreater(len(result), 0)
                self.assertEqual(result['description'], new_desc)
Esempio n. 9
0
    def test_positive_delete_by_id(self):
        """Create lifecycle environment with valid name, prior to
        Library

        :id: 76989039-5389-4136-9f7c-220eb38f157b

        :expectedresults: Lifecycle environment is deleted


        :CaseImportance: Critical
        """
        for name in valid_data_list():
            with self.subTest(name):
                new_lce = make_lifecycle_environment({
                    'name':
                    name,
                    'organization-id':
                    self.org['id']
                })
                LifecycleEnvironment.delete({'id': new_lce['id']})
                with self.assertRaises(CLIReturnCodeError):
                    LifecycleEnvironment.info({
                        'id': new_lce['id'],
                        'organization-id': self.org['id']
                    })
Esempio n. 10
0
    def test_positive_remove_lce(self):
        """Remove a lifecycle environment from organization

        @id: bfa9198e-6078-4f10-b79a-3d7f51b835fd

        @Assert: Lifecycle environment is removed from the org

        @CaseLevel: Integration
        """
        # Create a lifecycle environment.
        org_id = make_org()['id']
        lc_env_name = make_lifecycle_environment(
            {'organization-id': org_id})['name']
        lc_env_attrs = {
            'name': lc_env_name,
            'organization-id': org_id,
        }
        # Read back information about the lifecycle environment. Verify the
        # sanity of that information.
        response = LifecycleEnvironment.list(lc_env_attrs)
        self.assertEqual(response[0]['name'], lc_env_name)
        # Delete it.
        LifecycleEnvironment.delete(lc_env_attrs)
        # We should get a zero-length response when searching for the LC env.
        response = LifecycleEnvironment.list(lc_env_attrs)
        self.assertEqual(len(response), 0)
    def test_positive_update_1(self):
        """@Test: Create lifecycle environment then update its name

        @Feature: Lifecycle Environment

        @Assert: Lifecycle environment name is updated

        """
        new_lce = make_lifecycle_environment({
            'organization-id': self.org['id'],
        })
        for new_name in valid_data_list():
            with self.subTest(new_name):
                LifecycleEnvironment.update({
                    'id': new_lce['id'],
                    'new-name': new_name,
                    'organization-id': self.org['id'],
                    'prior': new_lce['prior-lifecycle-environment'],
                })
                result = LifecycleEnvironment.info({
                    'id': new_lce['id'],
                    'organization-id': self.org['id'],
                })
                self.assertGreater(len(result), 0)
                self.assertEqual(result['name'], new_name)
Esempio n. 12
0
    def test_positive_update_name(self):
        """Create lifecycle environment then update its name

        :id: de67a44e-6c6a-430e-927b-4fa43c7c2771

        :expectedresults: Lifecycle environment name is updated


        :CaseImportance: Critical
        """
        new_lce = make_lifecycle_environment(
            {'organization-id': self.org['id']})
        for new_name in valid_data_list():
            with self.subTest(new_name):
                LifecycleEnvironment.update({
                    'id': new_lce['id'],
                    'new-name': new_name,
                    'organization-id': self.org['id']
                })
                result = LifecycleEnvironment.info({
                    'id':
                    new_lce['id'],
                    'organization-id':
                    self.org['id']
                })
                self.assertGreater(len(result), 0)
                self.assertEqual(result['name'], new_name)
Esempio n. 13
0
    def test_positive_remove_lce(self):
        """Remove a lifecycle environment from organization

        @id: bfa9198e-6078-4f10-b79a-3d7f51b835fd

        @Assert: Lifecycle environment is removed from the org

        @CaseLevel: Integration
        """
        # Create a lifecycle environment.
        org_id = make_org()['id']
        lc_env_name = make_lifecycle_environment(
            {'organization-id': org_id})['name']
        lc_env_attrs = {
            'name': lc_env_name,
            'organization-id': org_id,
        }
        # Read back information about the lifecycle environment. Verify the
        # sanity of that information.
        response = LifecycleEnvironment.list(lc_env_attrs)
        self.assertEqual(response[0]['name'], lc_env_name)
        # Delete it.
        LifecycleEnvironment.delete(lc_env_attrs)
        # We should get a zero-length response when searching for the LC env.
        response = LifecycleEnvironment.list(lc_env_attrs)
        self.assertEqual(len(response), 0)
    def test_positive_update_name(self):
        """Create lifecycle environment then update its name

        :id: de67a44e-6c6a-430e-927b-4fa43c7c2771

        :expectedresults: Lifecycle environment name is updated


        :CaseImportance: Critical
        """
        new_lce = make_lifecycle_environment({
            'organization-id': self.org['id'],
        })
        for new_name in valid_data_list():
            with self.subTest(new_name):
                LifecycleEnvironment.update({
                    'id': new_lce['id'],
                    'new-name': new_name,
                    'organization-id': self.org['id'],
                })
                result = LifecycleEnvironment.info({
                    'id': new_lce['id'],
                    'organization-id': self.org['id'],
                })
                self.assertGreater(len(result), 0)
                self.assertEqual(result['name'], new_name)
    def test_positive_update_description(self):
        """Create lifecycle environment then update its description

        @Feature: Lifecycle Environment

        @Assert: Lifecycle environment description is updated

        """
        new_lce = make_lifecycle_environment({
            'organization-id': self.org['id'],
        })
        for new_desc in valid_data_list():
            with self.subTest(new_desc):
                LifecycleEnvironment.update({
                    'description': new_desc,
                    'id': new_lce['id'],
                    'organization-id': self.org['id'],
                    'prior': new_lce['prior-lifecycle-environment'],
                })
                result = LifecycleEnvironment.info({
                    'id': new_lce['id'],
                    'organization-id': self.org['id'],
                })
                self.assertGreater(len(result), 0)
                self.assertEqual(result['description'], new_desc)
Esempio n. 16
0
    def test_positive_update_unauthenticated_pull(self):
        """Create lifecycle environment and then update registry's
        unauthenticated pull

        :id: 8b73e0b7-30c9-4211-87a4-53dc0b0f3e21

        :expectedresults: Lifecycle environment registry's unauthenticated pull
            is updated


        :CaseImportance: Critical
        """
        lce = make_lifecycle_environment({'organization-id': self.org['id']})

        LifecycleEnvironment.update({
            'registry-unauthenticated-pull': 'true',
            'id': lce['id'],
            'organization-id': self.org['id'],
        })
        result = LifecycleEnvironment.info({
            'id': lce['id'],
            'organization-id': self.org['id']
        })
        self.assertGreater(len(result), 0)
        self.assertEqual(result['unauthenticated-pull'], 'true')
Esempio n. 17
0
    def test_positive_delete_1(self, test_data):
        """
        @Test: Create lifecycle environment with valid name, prior to Library
        @Feature: Lifecycle Environment
        @Assert: Lifecycle environment is deleted
        """

        payload = {"organization-id": self.org["label"], "name": test_data["name"]}

        new_obj = make_lifecycle_environment(payload)
        self.assertIsNotNone(new_obj, "Could not create lifecycle environment.")

        # Can we find the new object
        result = LifecycleEnvironment.info({"organization-id": self.org["label"], "id": new_obj["id"]})

        self.assertEqual(result.return_code, 0, "Could find the lifecycle environment")
        self.assertEqual(len(result.stderr), 0, "There should not be an error here.")
        self.assertGreater(len(result.stdout), 0, "No output was returned")
        self.assertEqual(
            new_obj["name"], result.stdout["name"], "Could not find lifecycle environment '%s'" % new_obj["name"]
        )

        # Delete the lifecycle environment
        result = LifecycleEnvironment.delete({"id": new_obj["id"]})

        self.assertEqual(result.return_code, 0, "Could find the lifecycle environment")
        self.assertEqual(len(result.stderr), 0, "There should not be an error here.")

        # Can we find the object
        result = LifecycleEnvironment.info({"organization-id": self.org["label"], "id": new_obj["id"]})

        self.assertGreater(result.return_code, 0, "Should not find the lifecycle environment")
        self.assertGreater(len(result.stderr), 0, "There should be an error here")
    def test_positive_update_1(self, test_data):
        """@Test: Create lifecycle environment then update its name

        @Feature: Lifecycle Environment

        @Assert: Lifecycle environment name is updated

        """

        payload = {
            'organization-id': self.org['id'],
        }

        new_obj = make_lifecycle_environment(payload)

        # Update its name
        result = LifecycleEnvironment.update({
            'organization-id': self.org['id'],
            'id': new_obj['id'],
            'new-name': test_data['name'],
        })
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        # Fetch the object
        result = LifecycleEnvironment.info({
            'organization-id': self.org['id'],
            'id': new_obj['id'],
        })
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
        self.assertGreater(len(result.stdout), 0)
        self.assertEqual(test_data['name'], result.stdout['name'])
        self.assertNotEqual(new_obj['name'], result.stdout['name'])
    def test_positive_delete_1(self, test_data):
        """@Test: Create lifecycle environment with valid name, prior to Library

        @Feature: Lifecycle Environment

        @Assert: Lifecycle environment is deleted

        """
        new_obj = make_lifecycle_environment({
            'organization-id': self.org['id'],
            'name': test_data['name'],
        })

        # Delete the lifecycle environment
        result = LifecycleEnvironment.delete({'id': new_obj['id']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        # Can we find the object
        result = LifecycleEnvironment.info({
            'organization-id': self.org['id'],
            'id': new_obj['id'],
        })
        self.assertGreater(result.return_code, 0)
        self.assertGreater(len(result.stderr), 0)
Esempio n. 20
0
def test_positive_add_and_remove_lce(module_org):
    """Remove a lifecycle environment from organization

    :id: bfa9198e-6078-4f10-b79a-3d7f51b835fd

    :expectedresults: Lifecycle environment is handled as expected

    :steps:
        1. create and add lce to org
        2. remove lce from org

    :CaseLevel: Integration
    """
    # Create a lifecycle environment.
    lc_env_name = make_lifecycle_environment({'organization-id': module_org.id})['name']
    lc_env_attrs = {'name': lc_env_name, 'organization-id': module_org.id}
    # Read back information about the lifecycle environment. Verify the
    # sanity of that information.
    response = LifecycleEnvironment.list(lc_env_attrs)
    assert response[0]['name'] == lc_env_name
    # Delete it.
    LifecycleEnvironment.delete(lc_env_attrs)
    # We should get a zero-length response when searching for the LC env.
    response = LifecycleEnvironment.list(lc_env_attrs)
    assert len(response) == 0
Esempio n. 21
0
    def test_positive_update_1(self, test_data):
        """@Test: Create lifecycle environment then update its name

        @Feature: Lifecycle Environment

        @Assert: Lifecycle environment name is updated

        @BZ: 1095937, 1099655

        """

        payload = {
            'organization-id': self.org['id'],
            }

        new_obj = make_lifecycle_environment(payload)
        self.assertIsNotNone(
            new_obj, "Could not create lifecycle environment.")

        # Update its name
        result = LifecycleEnvironment.update(
            {
                'organization-id': self.org['id'],
                'id': new_obj['id'],
                'new-name': test_data['name'],
            }
        )
        self.assertEqual(
            result.return_code, 0, "Could find the lifecycle environment"
        )
        self.assertEqual(
            len(result.stderr), 0, "There should not be an error here.")

        # Fetch the object
        result = LifecycleEnvironment.info(
            {
                'organization-id': self.org['id'],
                'id': new_obj['id'],
            }
        )
        self.assertEqual(
            result.return_code, 0, "Could find the lifecycle environment"
        )
        self.assertEqual(
            len(result.stderr), 0, "There should not be an error here.")
        self.assertGreater(
            len(result.stdout), 0, "No output was returned"
        )
        self.assertEqual(
            test_data['name'],
            result.stdout['name'],
            "Name was not updated"
        )
        self.assertNotEqual(
            new_obj['name'],
            result.stdout['name'],
            "Name should have been updated"
        )
Esempio n. 22
0
    def test_positive_delete_1(self, test_data):
        """@Test: Create lifecycle environment with valid name, prior to Library

        @Feature: Lifecycle Environment

        @Assert: Lifecycle environment is deleted

        """

        payload = {
            'organization-id': self.org['id'],
            'name': test_data['name'],
        }

        new_obj = make_lifecycle_environment(payload)
        self.assertIsNotNone(new_obj,
                             "Could not create lifecycle environment.")

        # Can we find the new object
        result = LifecycleEnvironment.info({
            'organization-id': self.org['id'],
            'id': new_obj['id'],
        })

        self.assertEqual(result.return_code, 0,
                         "Could find the lifecycle environment")
        self.assertEqual(len(result.stderr), 0,
                         "There should not be an error here.")
        self.assertGreater(len(result.stdout), 0, "No output was returned")
        self.assertEqual(
            new_obj['name'], result.stdout['name'],
            "Could not find lifecycle environment \'%s\'" % new_obj['name'])

        # Delete the lifecycle environment
        result = LifecycleEnvironment.delete({'id': new_obj['id']})

        self.assertEqual(result.return_code, 0,
                         "Could find the lifecycle environment")
        self.assertEqual(len(result.stderr), 0,
                         "There should not be an error here.")

        # Can we find the object
        result = LifecycleEnvironment.info({
            'organization-id': self.org['id'],
            'id': new_obj['id'],
        })

        self.assertGreater(result.return_code, 0,
                           "Should not find the lifecycle environment")
        self.assertGreater(len(result.stderr), 0,
                           "There should be an error here")
    def test_positive_delete_by_id(self):
        """Create lifecycle environment with valid name, prior to
        Library

        @id: 76989039-5389-4136-9f7c-220eb38f157b

        @Assert: Lifecycle environment is deleted

        """
        for name in valid_data_list():
            with self.subTest(name):
                new_lce = make_lifecycle_environment({"name": name, "organization-id": self.org["id"]})
                LifecycleEnvironment.delete({"id": new_lce["id"]})
                with self.assertRaises(CLIReturnCodeError):
                    LifecycleEnvironment.info({"id": new_lce["id"], "organization-id": self.org["id"]})
Esempio n. 24
0
    def test_environment_paths(self):
        """@Test: List the environment paths under a given organization

        @Feature: Lifecycle Environment

        @Assert: Lifecycle environment paths listed

        """
        try:
            org = make_org()
            test_env = make_lifecycle_environment({
                'organization-id': org['id'],
            })
        except CLIFactoryError as err:
            self.fail(err)

        # Add paths to lifecycle environments
        result = LifecycleEnvironment.paths({
            'organization-id': org['id'],
            'permission-type': 'readable',
        })
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
        self.assertIn(u'Library >> {0}'.format(test_env['name']),
                      u''.join(result.stdout))
    def test_environment_paths(self):
        """@Test: List the environment paths under a given organization

        @Feature: Lifecycle Environment

        @Assert: Lifecycle environment paths listed

        """
        try:
            org = make_org(cached=True)
            payload = {
                'organization-id': org['id'],
            }
            test_env = make_lifecycle_environment(payload)
        except CLIFactoryError as err:
            self.fail(err)

        # Add paths to lifecycle environments
        result = LifecycleEnvironment.paths({'organization-id': org['id'],
                                            'permission-type': 'readable'})
        self.assertEqual(result.return_code, 0,
                         "return code must be 0, instead got {0}".
                         format(result.return_code))
        self.assertEqual(
            len(result.stderr), 0,
            "There should not be an error here.")
        self.assertIn(u'Library >> {0}'.format(test_env['name']),
                      result.stdout)
    def test_environment_paths(self):
        """@Test: List the environment paths under a given organization

        @Feature: Lifecycle Environment

        @Assert: Lifecycle environment paths listed

        """
        try:
            org = make_org()
            test_env = make_lifecycle_environment({
                'organization-id': org['id'],
            })
        except CLIFactoryError as err:
            self.fail(err)

        # Add paths to lifecycle environments
        result = LifecycleEnvironment.paths({
            'organization-id': org['id'],
            'permission-type': 'readable',
        })
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
        self.assertIn(
            u'Library >> {0}'.format(test_env['name']),
            u''.join(result.stdout)
        )
    def test_positive_list_all_with_per_page(self):
        """Attempt to list more than 20 lifecycle environment with per-page
        option.

        :id: 6e10fb0e-5e2c-45e6-85a8-0c853450257b

        :BZ: 1420503

        :expectedresults: all the Lifecycle environments are listed
        """
        org = make_org()
        lifecycle_environments_count = 25
        per_page_count = lifecycle_environments_count + 5
        env_base_name = gen_string('alpha')
        last_env_name = ENVIRONMENT
        env_names = [last_env_name]
        for env_index in range(lifecycle_environments_count):
            env_name = '{0}-{1}'.format(env_base_name, env_index)
            make_lifecycle_environment({
                'name': env_name,
                'organization-id': org['id'],
                'prior': last_env_name
            })
            last_env_name = env_name
            env_names.append(env_name)

        lifecycle_environments = LifecycleEnvironment.list({
            'organization-id': org['id'],
            'per_page': per_page_count
        })

        self.assertEqual(len(lifecycle_environments),
                         lifecycle_environments_count + 1)
        env_name_set = {env['name'] for env in lifecycle_environments}
        self.assertEqual(env_name_set, set(env_names))
Esempio n. 28
0
 def setUpClass(cls):
     """Tests for Content Host via Hammer CLI"""
     super(ContentHostTestCase, cls).setUpClass()
     ContentHostTestCase.NEW_ORG = make_org(cached=True)
     ContentHostTestCase.NEW_LIFECYCLE = make_lifecycle_environment(
         {u"organization-id": ContentHostTestCase.NEW_ORG["id"]}, cached=True
     )
     ContentHostTestCase.LIBRARY = LifecycleEnvironment.info(
         {u"organization-id": ContentHostTestCase.NEW_ORG["id"], u"name": u"Library"}
     )
     ContentHostTestCase.DEFAULT_CV = ContentView.info(
         {u"organization-id": ContentHostTestCase.NEW_ORG["id"], u"name": u"Default Organization View"}
     )
     ContentHostTestCase.NEW_CV = make_content_view({u"organization-id": ContentHostTestCase.NEW_ORG["id"]})
     cv_id = ContentHostTestCase.NEW_CV["id"]
     ContentView.publish({u"id": cv_id})
     version_id = ContentView.version_list({u"content-view-id": cv_id})[0]["id"]
     ContentView.version_promote(
         {
             u"id": version_id,
             u"to-lifecycle-environment-id": ContentHostTestCase.NEW_LIFECYCLE["id"],
             u"organization-id": ContentHostTestCase.NEW_ORG["id"],
         }
     )
     ContentHostTestCase.PROMOTED_CV = ContentHostTestCase.NEW_CV
Esempio n. 29
0
    def test_bugzilla_1077333(self):
        """@Test: Search lifecycle environment via its name containing UTF-8 chars

        @Feature: Lifecycle Environment

        @Assert: Can get info for lifecycle by its name

        """

        payload = {
            'organization-id': self.org['id'],
            'name': gen_string('utf8', 15),
        }

        new_obj = make_lifecycle_environment(payload)
        self.assertIsNotNone(new_obj,
                             "Could not create lifecycle environment.")

        # Can we find the new object
        result = LifecycleEnvironment.info({
            'organization-id': self.org['id'],
            'name': new_obj['name'],
        })

        self.assertEqual(result.return_code, 0,
                         "Could find the lifecycle environment")
        self.assertEqual(len(result.stderr), 0,
                         "There should not be an error here.")
        self.assertGreater(len(result.stdout), 0, "No output was returned")
        self.assertEqual(
            new_obj['name'], result.stdout['name'],
            "Could not find lifecycle environment \'%s\'" % new_obj['name'])
Esempio n. 30
0
 def setup_content_view(self, org_id, lce_id=None):
     # type: (int, int) -> Tuple[Dict, Dict]
     """Setup organization content view by adding all the repositories, publishing and promoting
     to lce if needed.
     """
     if lce_id is None:
         lce = make_lifecycle_environment({'organization-id': org_id})
     else:
         lce = LifecycleEnvironment.info({
             'id': lce_id,
             'organization-id': org_id,
         })
     content_view = make_content_view({'organization-id': org_id})
     # Add repositories to content view
     for repo in self:
         repo.add_to_content_view(org_id, content_view['id'])
     # Publish the content view
     ContentView.publish({'id': content_view['id']})
     if lce['name'] != ENVIRONMENT:
         # Get the latest content view version id
         content_view_version = ContentView.info({'id': content_view['id']
                                                  })['versions'][-1]
         # Promote content view version to lifecycle environment
         ContentView.version_promote({
             'id':
             content_view_version['id'],
             'organization-id':
             org_id,
             'to-lifecycle-environment-id':
             lce['id'],
         })
     content_view = ContentView.info({'id': content_view['id']})
     return content_view, lce
Esempio n. 31
0
    def setUp(self):
        """
        Tests for activation keys via Hammer CLI
        """

        super(TestActivationKey, self).setUp()

        if TestActivationKey.org is None:
            TestActivationKey.org = make_org()
        if TestActivationKey.env1 is None:
            TestActivationKey.env1 = make_lifecycle_environment(
                {u'organization-id': TestActivationKey.org['id']})
        if TestActivationKey.env2 is None:
            TestActivationKey.env2 = make_lifecycle_environment({
                u'organization-id':
                TestActivationKey.org['id'],
                u'prior':
                TestActivationKey.env1['label']
            })
        if TestActivationKey.product is None:
            TestActivationKey.product = make_product(
                {u'organization-id': TestActivationKey.org['id']})

        if TestActivationKey.library is None:
            TestActivationKey.library = LifecycleEnvironment.info({
                'organization-id':
                TestActivationKey.org['id'],
                'name':
                'Library'
            }).stdout
 def setUpClass(cls):
     """Tests for Content Host via Hammer CLI"""
     super(ContentHostTestCase, cls).setUpClass()
     ContentHostTestCase.NEW_ORG = make_org(cached=True)
     ContentHostTestCase.NEW_LIFECYCLE = make_lifecycle_environment(
         {u'organization-id': ContentHostTestCase.NEW_ORG['id']},
         cached=True
     )
     ContentHostTestCase.LIBRARY = LifecycleEnvironment.info({
         u'organization-id': ContentHostTestCase.NEW_ORG['id'],
         u'name': u'Library',
     })
     ContentHostTestCase.DEFAULT_CV = ContentView.info({
         u'organization-id': ContentHostTestCase.NEW_ORG['id'],
         u'name': u'Default Organization View',
     })
     ContentHostTestCase.NEW_CV = make_content_view({
         u'organization-id': ContentHostTestCase.NEW_ORG['id'],
     })
     cv_id = ContentHostTestCase.NEW_CV['id']
     ContentView.publish({u'id': cv_id})
     version_id = ContentView.version_list({
         u'content-view-id': cv_id,
     })[0]['id']
     ContentView.version_promote({
         u'id': version_id,
         u'to-lifecycle-environment-id': ContentHostTestCase.NEW_LIFECYCLE[
             'id'
         ],
         u'organization-id': ContentHostTestCase.NEW_ORG['id']
     })
     ContentHostTestCase.PROMOTED_CV = ContentHostTestCase.NEW_CV
Esempio n. 33
0
    def setUp(self):
        """
        Tests for Content Host via Hammer CLI
        """

        super(TestContentHost, self).setUp()

        if TestContentHost.NEW_ORG is None:
            TestContentHost.NEW_ORG = make_org()
        if TestContentHost.NEW_LIFECYCLE is None:
            TestContentHost.NEW_LIFECYCLE = make_lifecycle_environment(
                {u'organization-id': TestContentHost.NEW_ORG['id']}
            )
        if TestContentHost.LIBRARY is None:
            library_result = LifecycleEnvironment.info(
                {u'organization-id': TestContentHost.NEW_ORG['id'],
                 u'name': u'Library'}
            )
            TestContentHost.LIBRARY = library_result.stdout
        if TestContentHost.DEFAULT_CV is None:
            cv_result = ContentView.info(
                {u'organization-id': TestContentHost.NEW_ORG['id'],
                 u'name': u'Default Organization View'}
            )
            TestContentHost.DEFAULT_CV = cv_result.stdout
Esempio n. 34
0
    def setUp(self):
        """Tests for Host Collections via Hammer CLI"""
        super(HostCollectionTestCase, self).setUp()

        if HostCollectionTestCase.org is None:
            HostCollectionTestCase.org = make_org(cached=True)
        if HostCollectionTestCase.new_lifecycle is None:
            HostCollectionTestCase.new_lifecycle = make_lifecycle_environment(
                {u"organization-id": HostCollectionTestCase.org["id"]}, cached=True
            )
        if HostCollectionTestCase.library is None:
            HostCollectionTestCase.library = LifecycleEnvironment.info(
                {u"organization-id": HostCollectionTestCase.org["id"], u"name": ENVIRONMENT}
            )
        if HostCollectionTestCase.default_cv is None:
            HostCollectionTestCase.default_cv = ContentView.info(
                {u"organization-id": HostCollectionTestCase.org["id"], u"name": DEFAULT_CV}
            )
        if HostCollectionTestCase.new_cv is None:
            HostCollectionTestCase.new_cv = make_content_view({u"organization-id": HostCollectionTestCase.org["id"]})
            HostCollectionTestCase.promoted_cv = None
            cv_id = HostCollectionTestCase.new_cv["id"]
            ContentView.publish({u"id": cv_id})
            result = ContentView.version_list({u"content-view-id": cv_id})
            version_id = result[0]["id"]
            ContentView.version_promote(
                {
                    u"id": version_id,
                    u"organization-id": HostCollectionTestCase.org["id"],
                    u"to-lifecycle-environment-id": (HostCollectionTestCase.new_lifecycle["id"]),
                }
            )
            HostCollectionTestCase.promoted_cv = HostCollectionTestCase.new_cv
Esempio n. 35
0
 def setup_content_view(self, org_id, lce_id=None):
     # type: (int, int) -> Tuple[Dict, Dict]
     """Setup organization content view by adding all the repositories, publishing and promoting
     to lce if needed.
     """
     if lce_id is None:
         lce = make_lifecycle_environment({'organization-id': org_id})
     else:
         lce = LifecycleEnvironment.info({
             'id': lce_id,
             'organization-id': org_id,
         })
     content_view = make_content_view({'organization-id': org_id})
     # Add repositories to content view
     for repo in self:
         repo.add_to_content_view(org_id, content_view['id'])
     # Publish the content view
     ContentView.publish({'id': content_view['id']})
     if lce['name'] != ENVIRONMENT:
         # Get the latest content view version id
         content_view_version = ContentView.info({
             'id': content_view['id']
         })['versions'][-1]
         # Promote content view version to lifecycle environment
         ContentView.version_promote({
             'id': content_view_version['id'],
             'organization-id': org_id,
             'to-lifecycle-environment-id': lce['id'],
         })
     content_view = ContentView.info({'id': content_view['id']})
     return content_view, lce
Esempio n. 36
0
    def test_bugzilla_1077386(self):
        """
        @Test: List subcommand returns standard output
        @Feature: Lifecycle Environment
        @Assert: There should not be an error returned
        """

        # List avaialble lifecycle environments using default Table
        # output
        cmd = u"lifecycle-environment list --organization-id=\"%s\""
        result = LifecycleEnvironment.execute(
            cmd % self.org['id'],
            None,
            None,
            False
        )

        self.assertEqual(
            result.return_code, 0, "Could not find the lifecycle environment"
        )
        self.assertEqual(
            len(result.stderr), 0, "There should not be an error here.")
        self.assertGreater(
            len(result.stdout), 0, "No output was returned"
        )
Esempio n. 37
0
    def test_positive_update_2(self, test_data):
        """@Test: Create lifecycle environment then update its description

        @Feature: Lifecycle Environment

        @Assert: Lifecycle environment description is updated

        """

        payload = {
            'organization-id': self.org['id'],
        }

        new_obj = make_lifecycle_environment(payload)
        self.assertIsNotNone(new_obj,
                             "Could not create lifecycle environment.")

        # Update its description
        result = LifecycleEnvironment.update({
            'organization-id':
            self.org['id'],
            'id':
            new_obj['id'],
            'description':
            test_data['description'],
        })
        self.assertEqual(result.return_code, 0,
                         "Could find the lifecycle environment")
        self.assertEqual(len(result.stderr), 0,
                         "There should not be an error here.")

        # Fetch the object
        result = LifecycleEnvironment.info({
            'organization-id': self.org['id'],
            'id': new_obj['id'],
        })
        self.assertEqual(result.return_code, 0,
                         "Could find the lifecycle environment")
        self.assertEqual(len(result.stderr), 0,
                         "There should not be an error here.")
        self.assertGreater(len(result.stdout), 0, "No output was returned")
        self.assertEqual(test_data['description'],
                         result.stdout['description'],
                         "Description was not updated")
        self.assertNotEqual(new_obj['description'],
                            result.stdout['description'],
                            "Description should have been updated")
Esempio n. 38
0
 def get_default_env():
     """Get default lifecycle environment"""
     return LifecycleEnvironment.info({
         'organization-id':
         ActivationKeyTestCase.org['id'],
         'name':
         'Library',
     })
    def test_positive_update_name(self):
        """Create lifecycle environment then update its name

        @id: de67a44e-6c6a-430e-927b-4fa43c7c2771

        @Assert: Lifecycle environment name is updated

        """
        new_lce = make_lifecycle_environment({"organization-id": self.org["id"]})
        for new_name in valid_data_list():
            with self.subTest(new_name):
                LifecycleEnvironment.update(
                    {"id": new_lce["id"], "new-name": new_name, "organization-id": self.org["id"]}
                )
                result = LifecycleEnvironment.info({"id": new_lce["id"], "organization-id": self.org["id"]})
                self.assertGreater(len(result), 0)
                self.assertEqual(result["name"], new_name)
    def test_positive_update_description(self):
        """Create lifecycle environment then update its description

        @id: 15b82949-3c3a-4942-b42b-db1de34cf5be

        @Assert: Lifecycle environment description is updated

        """
        new_lce = make_lifecycle_environment({"organization-id": self.org["id"]})
        for new_desc in valid_data_list():
            with self.subTest(new_desc):
                LifecycleEnvironment.update(
                    {"description": new_desc, "id": new_lce["id"], "organization-id": self.org["id"]}
                )
                result = LifecycleEnvironment.info({"id": new_lce["id"], "organization-id": self.org["id"]})
                self.assertGreater(len(result), 0)
                self.assertEqual(result["description"], new_desc)
def test_positive_lce_crud(module_org):
    """CRUD test case for lifecycle environment for name, description, label, registry name pattern,
    and unauthenticated pull

    :id: 6b0fbf4f-528c-4983-bc3f-e81ccb7438fd

    :expectedresults: Lifecycle environment is created, read, updated, and deleted successfull

    :CaseImportance: High
    """
    name = gen_string('alpha')
    new_name = gen_string('alpha')
    desc = gen_string('alpha')
    new_desc = gen_string('alpha')
    label = gen_string('alpha')
    org_name = module_org.name
    registry_name_pattern = (
        "{}-<%= organization.label %>/<%= repository.docker_upstream_name %>"
    ).format(gen_string('alpha', 5))

    # create
    lce = make_lifecycle_environment({
        'organization': org_name,
        'organization-id': module_org.id,
        'name': name,
        'label': label,
        'description': desc,
    })

    assert lce['prior-lifecycle-environment'] == ENVIRONMENT
    assert lce['name'] == name
    assert lce['description'] == desc
    assert lce['label'] == label
    assert lce['organization'] == org_name

    # update
    LifecycleEnvironment.update({
        'id': lce['id'],
        'new-name': new_name,
        'description': new_desc,
        'registry-unauthenticated-pull': 'true',
        'registry-name-pattern': registry_name_pattern,
    })
    lce = LifecycleEnvironment.info({
        'id': lce['id'],
        'organization-id': module_org.id
    })
    assert lce['name'] == new_name
    assert lce['registry-name-pattern'] == registry_name_pattern
    assert lce['unauthenticated-pull'] == 'true'

    # delete
    LifecycleEnvironment.delete({'id': lce['id']})
    with pytest.raises(CLIReturnCodeError):
        LifecycleEnvironment.info({
            'id': lce['id'],
            'organization-id': module_org.id
        })
Esempio n. 42
0
 def setUpClass(cls):
     """Prepare some data to be used in tests"""
     super(HostCollectionTestCase, cls).setUpClass()
     cls.organization = make_org()
     cls.library = LifecycleEnvironment.info(
         {'organization-id': cls.organization['id'], 'name': ENVIRONMENT}
     )
     cls.default_cv = ContentView.info(
         {'organization-id': cls.organization['id'], 'name': DEFAULT_CV}
     )
     make_host_collection({'organization-id': cls.organization['id']})
Esempio n. 43
0
 def setUpClass(cls):
     """Prepare some data to be used in tests"""
     super(HostCollectionTestCase, cls).setUpClass()
     cls.organization = make_org()
     cls.library = LifecycleEnvironment.info({
         u'organization-id': cls.organization['id'],
         u'name': ENVIRONMENT,
     })
     cls.default_cv = ContentView.info({
         u'organization-id': cls.organization['id'],
         u'name': DEFAULT_CV
     })
Esempio n. 44
0
def _make_fake_host_helper(module_org):
    """Make a new fake host"""
    library = LifecycleEnvironment.info({'organization-id': module_org.id, 'name': ENVIRONMENT})
    default_cv = ContentView.info({'organization-id': module_org.id, 'name': DEFAULT_CV})
    return make_fake_host(
        {
            'content-view-id': default_cv['id'],
            'lifecycle-environment-id': library['id'],
            'name': gen_string('alpha', 15),
            'organization-id': module_org.id,
        }
    )
    def test_positive_delete_by_id(self):
        """Create lifecycle environment with valid name, prior to
        Library

        @Feature: Lifecycle Environment

        @Assert: Lifecycle environment is deleted

        """
        for name in valid_data_list():
            with self.subTest(name):
                new_lce = make_lifecycle_environment({
                    'name': name,
                    'organization-id': self.org['id'],
                })
                LifecycleEnvironment.delete({'id': new_lce['id']})
                with self.assertRaises(CLIReturnCodeError):
                    LifecycleEnvironment.info({
                        'id': new_lce['id'],
                        'organization-id': self.org['id'],
                    })
Esempio n. 46
0
    def test_positive_list_with_pagination(self):
        """Make sure lces list can be displayed with different items per page
        value

        :id: 28ecbc1f-bb5c-49df-a586-8cfdc0dd57df

        :BZ: 1368590

        :expectedresults: `per-page` correctly sets amount of items displayed
            per page, different `per-page` values divide a list into correct
            number of pages

        :CaseImportance: Critical
        """
        # Test different `per-page` values
        for per_page in (1, 5, 20):
            with self.subTest(per_page):
                # Verify the first page contains exactly the same items count
                # as `per-page` value
                lces = LifecycleEnvironment.list({
                    'organization-id':
                    self.org['id'],
                    'per-page':
                    per_page,
                })
                self.assertEqual(len(lces), per_page)
                # Verify pagination and total amount of pages by checking the
                # items count on the last page
                last_page = (self.lces_count / per_page +
                             int(self.lces_count % per_page != 0))
                lces = LifecycleEnvironment.list({
                    'organization-id':
                    self.org['id'],
                    'page':
                    last_page,
                    'per-page':
                    per_page,
                })
                self.assertEqual(len(lces), self.lces_count % per_page
                                 or per_page)
    def test_positve_list_paths(self):
        """List the environment paths under a given organization

        @id: 71600d6b-1ef4-4b88-8e9b-eb2481ee1fe2

        @Assert: Lifecycle environment paths listed

        """
        org = make_org()
        lc_env = make_lifecycle_environment({"organization-id": org["id"]})
        # Add paths to lifecycle environments
        result = LifecycleEnvironment.paths({"organization-id": org["id"], "permission-type": "readable"})
        self.assertIn(u"Library >> {0}".format(lc_env["name"]), u"".join(result))
    def test_verify_bugzilla_1077386(self):
        """List subcommand returns standard output

        @id: cca249d0-fb77-422b-aae3-3361887269db

        @Assert: There should not be an error returned

        """

        # List available lifecycle environments using default Table
        # output
        cmd = u'lifecycle-environment list --organization-id="%s"'
        result = LifecycleEnvironment.execute(cmd % self.org["id"], None, None, False)
        self.assertGreater(len(result), 0)
    def test_positive_delete_by_id(self):
        """Create lifecycle environment with valid name, prior to
        Library

        :id: 76989039-5389-4136-9f7c-220eb38f157b

        :expectedresults: Lifecycle environment is deleted


        :CaseImportance: Critical
        """
        for name in valid_data_list():
            with self.subTest(name):
                new_lce = make_lifecycle_environment({
                    'name': name,
                    'organization-id': self.org['id'],
                })
                LifecycleEnvironment.delete({'id': new_lce['id']})
                with self.assertRaises(CLIReturnCodeError):
                    LifecycleEnvironment.info({
                        'id': new_lce['id'],
                        'organization-id': self.org['id'],
                    })
    def test_verify_bugzilla_1077333(self):
        """Search lifecycle environment via its name containing UTF-8
        chars

        @id: d15001ed-5bbf-43cf-bdd3-1e129dff14ec

        @Assert: Can get info for lifecycle by its name

        """
        test_data = {"name": gen_string("utf8", 15), "organization-id": self.org["id"]}
        # Can we find the new object
        result = LifecycleEnvironment.info(
            {"name": make_lifecycle_environment(test_data)["name"], "organization-id": self.org["id"]}
        )
        self.assertEqual(result["name"], test_data["name"])
Esempio n. 51
0
    def test_positive_remove_lce(self):
        """@Test: Add a lifecycle environment and then remove it

        @Feature: Organization

        @Assert: Lifecycle environment is removed from the org
        """
        # Create a lifecycle environment.
        org_id = make_org()['id']
        lc_env_name = make_lifecycle_environment(
            {'organization-id': org_id})['name']
        lc_env_attrs = {
            'name': lc_env_name,
            'organization-id': org_id,
        }
        # Read back information about the lifecycle environment. Verify the
        # sanity of that information.
        response = LifecycleEnvironment.list(lc_env_attrs)
        self.assertEqual(response[0]['name'], lc_env_name)
        # Delete it.
        LifecycleEnvironment.delete(lc_env_attrs)
        # We should get a zero-length response when searcing for the LC env.
        response = LifecycleEnvironment.list(lc_env_attrs)
        self.assertEqual(len(response), 0)
Esempio n. 52
0
    def test_verify_bugzilla_1077386(self):
        """List subcommand returns standard output

        :id: cca249d0-fb77-422b-aae3-3361887269db

        :expectedresults: There should not be an error returned

        :CaseImportance: High
        """

        # List available lifecycle environments using default Table
        # output
        cmd = 'lifecycle-environment list --organization-id="%s"'
        result = LifecycleEnvironment.execute(cmd % self.org['id'], None, None,
                                              False)
        self.assertGreater(len(result), 0)
def test_positve_list_paths(module_org):
    """List the environment paths under a given organization

    :id: 71600d6b-1ef4-4b88-8e9b-eb2481ee1fe2

    :expectedresults: Lifecycle environment paths listed


    :CaseImportance: Critical
    """
    lc_env = make_lifecycle_environment({'organization-id': module_org.id})
    # Add paths to lifecycle environments
    result = LifecycleEnvironment.paths({
        'organization-id': module_org.id,
        'permission-type': 'readable'
    })
    assert f"Library >> {lc_env['name']}" in ''.join(result)
Esempio n. 54
0
    def setUp(self):  # noqa
        """Tests for Content Host via Hammer CLI"""

        super(TestContentHost, self).setUp()

        if TestContentHost.NEW_ORG is None:
            TestContentHost.NEW_ORG = make_org(cached=True)
        if TestContentHost.NEW_LIFECYCLE is None:
            TestContentHost.NEW_LIFECYCLE = make_lifecycle_environment(
                {u'organization-id': TestContentHost.NEW_ORG['id']},
                cached=True)
        if TestContentHost.LIBRARY is None:
            library_result = LifecycleEnvironment.info({
                u'organization-id':
                TestContentHost.NEW_ORG['id'],
                u'name':
                u'Library'
            })
            TestContentHost.LIBRARY = library_result.stdout
        if TestContentHost.DEFAULT_CV is None:
            cv_result = ContentView.info({
                u'organization-id':
                TestContentHost.NEW_ORG['id'],
                u'name':
                u'Default Organization View'
            })
            TestContentHost.DEFAULT_CV = cv_result.stdout
        if TestContentHost.NEW_CV is None:
            TestContentHost.NEW_CV = make_content_view(
                {u'organization-id': TestContentHost.NEW_ORG['id']})
            TestContentHost.PROMOTED_CV = None
            cv_id = TestContentHost.NEW_CV['id']
            ContentView.publish({u'id': cv_id})
            result = ContentView.version_list({u'content-view-id': cv_id})
            version_id = result.stdout[0]['id']
            promotion = ContentView.version_promote({
                u'id':
                version_id,
                u'to-lifecycle-environment-id':
                TestContentHost.NEW_LIFECYCLE['id'],
                u'organization-id':
                TestContentHost.NEW_ORG['id']
            })
            if promotion.stderr == []:
                TestContentHost.PROMOTED_CV = TestContentHost.NEW_CV
Esempio n. 55
0
    def setUp(self):  # noqa
        """Tests for Host Collections via Hammer CLI"""

        super(TestHostCollection, self).setUp()

        if TestHostCollection.org is None:
            TestHostCollection.org = make_org(cached=True)
        if TestHostCollection.new_lifecycle is None:
            TestHostCollection.new_lifecycle = make_lifecycle_environment(
                {u'organization-id': TestHostCollection.org['id']},
                cached=True)
        if TestHostCollection.library is None:
            library_result = LifecycleEnvironment.info({
                u'organization-id':
                TestHostCollection.org['id'],
                u'name':
                u'Library'
            })
            TestHostCollection.library = library_result.stdout
        if TestHostCollection.default_cv is None:
            cv_result = ContentView.info({
                u'organization-id':
                TestHostCollection.org['id'],
                u'name':
                u'Default Organization View'
            })
            TestHostCollection.default_cv = cv_result.stdout
        if TestHostCollection.new_cv is None:
            TestHostCollection.new_cv = make_content_view(
                {u'organization-id': TestHostCollection.org['id']})
            TestHostCollection.promoted_cv = None
            cv_id = TestHostCollection.new_cv['id']
            ContentView.publish({u'id': cv_id})
            result = ContentView.version_list({u'content-view-id': cv_id})
            version_id = result.stdout[0]['id']
            promotion = ContentView.version_promote({
                u'id':
                version_id,
                u'to-lifecycle-environment-id':
                (TestHostCollection.new_lifecycle['id']),
                u'organization-id':
                TestHostCollection.org['id']
            })
            if promotion.stderr == []:
                TestHostCollection.promoted_cv = TestHostCollection.new_cv
Esempio n. 56
0
    def test_positve_list_paths(self):
        """List the environment paths under a given organization

        :id: 71600d6b-1ef4-4b88-8e9b-eb2481ee1fe2

        :expectedresults: Lifecycle environment paths listed


        :CaseImportance: Critical
        """
        org = make_org()
        lc_env = make_lifecycle_environment({'organization-id': org['id']})
        # Add paths to lifecycle environments
        result = LifecycleEnvironment.paths({
            'organization-id': org['id'],
            'permission-type': 'readable'
        })
        self.assertIn('Library >> {0}'.format(lc_env['name']), ''.join(result))
Esempio n. 57
0
    def test_positive_add_lce(self):
        """Add a lifecycle environment to organization

        @Feature: Organization

        @Assert: Lifecycle environment is added to the org
        """
        # Create a lifecycle environment.
        org_id = make_org()['id']
        lc_env_name = make_lifecycle_environment(
            {'organization-id': org_id})['name']
        # Read back information about the lifecycle environment. Verify the
        # sanity of that information.
        response = LifecycleEnvironment.list({
            'name': lc_env_name,
            'organization-id': org_id,
        })
        self.assertEqual(response[0]['name'], lc_env_name)
def test_positive_list_subcommand(module_org):
    """List subcommand returns standard output

    :id: cca249d0-fb77-422b-aae3-3361887269db

    :expectedresults: There should not be an error returned

    :BZ: 1077386

    :CaseImportance: High
    """

    # List available lifecycle environments using default Table
    # output
    cmd = 'lifecycle-environment list --organization-id="%s"'
    result = LifecycleEnvironment.execute(cmd % module_org.id, None, None,
                                          False)
    assert len(result) > 0
    def test_verify_bugzilla_1077386(self):
        """List subcommand returns standard output

        @Feature: Lifecycle Environment

        @Assert: There should not be an error returned

        """

        # List available lifecycle environments using default Table
        # output
        cmd = u'lifecycle-environment list --organization-id="%s"'
        result = LifecycleEnvironment.execute(
            cmd % self.org['id'],
            None,
            None,
            False,
        )
        self.assertGreater(len(result), 0)