def test_flavor_update_metadata(self):
     """Test update flavor metadata
     * logs in as admin user
     * creates a new flavor
     * verifies the flavor appears in the flavors table
     * verifies that Metadata column of the table contains 'No'
     * invokes action 'Update Metadata' for the new flavor
     * adds custom filed 'metadata'
     * adds value 'flavor' for the custom filed 'metadata'
     * verifies that Metadata column of the table is updated to Yes
     * deletes the newly created flavor
     * verifies the flavor does not appear in the table after deletion
     """
     new_metadata = {'metadata1': helpers.gen_random_resource_name("value"),
                     'metadata2': helpers.gen_random_resource_name("value")}
     flavors_page = self.flavor_create()
     self.assertTrue(
         flavors_page.get_metadata_column_value(self.FLAVOR_NAME) == 'No')
     flavors_page.add_custom_metadata(self.FLAVOR_NAME, new_metadata)
     self.assertTrue(
         flavors_page.get_metadata_column_value(self.FLAVOR_NAME) == 'Yes')
     results = flavors_page.check_flavor_metadata(self.FLAVOR_NAME,
                                                  new_metadata)
     self.flavor_delete()
     self.assertSequenceTrue(results)  # custom matcher
Пример #2
0
    def test_update_image_metadata(self):
        """Test update image metadata
        * logs in as admin user
        * creates image from locally downloaded file
        * verifies the image appears in the images table as active
        * invokes action 'Update Metadata' for the image
        * adds custom filed 'metadata'
        * adds value 'image' for the custom filed 'metadata'
        * gets the actual description of the image
        * verifies that custom filed is present in the image description
        * deletes the image
        * verifies the image does not appear in the table after deletion
        """
        new_metadata = {'metadata1': helpers.gen_random_resource_name("value"),
                        'metadata2': helpers.gen_random_resource_name("value")}

        with helpers.gen_temporary_file() as file_name:
            # TODO(tsufiev): had to add non-empty description to an image,
            # because description is now considered a metadata and we want
            # the metadata in a newly created image to be valid
            images_page = self.image_create(local_file=file_name,
                                            description='test description')
            images_page.add_custom_metadata(self.IMAGE_NAME, new_metadata)
            results = images_page.check_image_details(self.IMAGE_NAME,
                                                      new_metadata)
            self.image_delete(self.IMAGE_NAME)
            self.assertSequenceTrue(results)
Пример #3
0
    def test_edit_image_description_and_name(self):
        """tests that image description is editable

        * creates image from locally downloaded file
        * verifies the image appears in the images table as active
        * toggle edit action and adds some description
        * verifies that edit action was successful
        * verifies that new description is seen on image details page
        * toggle edit action and changes image name
        * verifies that edit action was successful
        * verifies that image with new name is seen on the page
        * deletes the image
        * verifies the image does not appear in the table after deletion
        """
        new_description_text = helpers.gen_random_resource_name("description")
        new_image_name = helpers.gen_random_resource_name("image")
        with helpers.gen_temporary_file() as file_name:
            images_page = self.image_create(local_file=file_name)
            images_page.edit_image(self.IMAGE_NAME,
                                   description=new_description_text)
            self.assertTrue(
                images_page.find_message_and_dismiss(messages.SUCCESS))
            self.assertFalse(
                images_page.find_message_and_dismiss(messages.ERROR))

            results = images_page.check_image_details(self.IMAGE_NAME,
                                                      {'Description':
                                                       new_description_text})
            self.assertSequenceTrue(results)

            # Just go back to the images page and toggle edit again
            images_page = self.images_page
            images_page.edit_image(self.IMAGE_NAME,
                                   new_name=new_image_name)
            self.assertTrue(
                images_page.find_message_and_dismiss(messages.SUCCESS))
            self.assertFalse(
                images_page.find_message_and_dismiss(messages.ERROR))

            results = images_page.check_image_details(new_image_name,
                                                      {'Name':
                                                       new_image_name})
            self.assertSequenceTrue(results)

            self.image_delete(new_image_name)
Пример #4
0
    def test_manage_volume_attachments(self):
        """This test case checks attach/detach actions for volume

        Steps:
        1. Login to Horizon Dashboard as horizon user
        2. Navigate to Project -> Compute -> Instances, create instance
        3. Navigate to Project -> Volumes -> Volumes, create volume
        4. Attach volume to instance from step2
        5. Check that volume status and link to instance
        6. Detach volume from instance
        7. Check volume status
        8. Delete volume and instance
        """
        instance_name = helpers.gen_random_resource_name('instance')
        instances_page = self.home_pg.go_to_project_compute_instancespage()
        instances_page.create_instance(instance_name)
        instances_page.find_message_and_dismiss(messages.SUCCESS)
        self.assertFalse(
            instances_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(instances_page.is_instance_active(instance_name))

        volumes_page = self.volumes_page
        volumes_page.create_volume(self.VOLUME_NAME)
        volumes_page.find_message_and_dismiss(messages.INFO)
        self.assertFalse(volumes_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(volumes_page.is_volume_status(self.VOLUME_NAME,
                                                      'Available'))

        volumes_page.attach_volume_to_instance(self.VOLUME_NAME, instance_name)
        volumes_page.find_message_and_dismiss(messages.INFO)
        self.assertFalse(volumes_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(volumes_page.is_volume_status(self.VOLUME_NAME,
                                                      'In-use'))
        self.assertTrue(
            volumes_page.is_volume_attached_to_instance(self.VOLUME_NAME,
                                                        instance_name))

        volumes_page.detach_volume_from_instance(self.VOLUME_NAME,
                                                 instance_name)
        volumes_page.find_message_and_dismiss(messages.SUCCESS)
        self.assertFalse(volumes_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(volumes_page.is_volume_status(self.VOLUME_NAME,
                                                      'Available'))

        volumes_page.delete_volume(self.VOLUME_NAME)
        volumes_page.find_message_and_dismiss(messages.SUCCESS)
        self.assertFalse(volumes_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(volumes_page.is_volume_deleted(self.VOLUME_NAME))

        instances_page = self.home_pg.go_to_project_compute_instancespage()
        instances_page.delete_instance(instance_name)
        instances_page.find_message_and_dismiss(messages.SUCCESS)
        self.assertFalse(
            instances_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(instances_page.is_instance_deleted(instance_name))
    def test_manage_volume_attachments(self):
        """This test case checks attach/detach actions for volume
            Steps:
            1. Login to Horizon Dashboard as horizon user
            2. Navigate to Project -> Compute -> Instances, create instance
            3. Navigate to Project -> Compute -> Volumes, create volume
            4. Attach volume to instance from step2
            5. Check that volume status and link to instance
            6. Detach volume from instance
            7. Check volume status
            8. Delete volume and instance
        """
        instance_name = helpers.gen_random_resource_name('instance')
        instances_page = self.home_pg.go_to_compute_instancespage()
        instances_page.create_instance(instance_name)
        instances_page.find_message_and_dismiss(messages.SUCCESS)
        self.assertFalse(
            instances_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(instances_page.is_instance_active(instance_name))

        volumes_page = self.volumes_page
        volumes_page.create_volume(self.VOLUME_NAME)
        volumes_page.find_message_and_dismiss(messages.INFO)
        self.assertFalse(volumes_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(
            volumes_page.is_volume_status(self.VOLUME_NAME, 'Available'))

        volumes_page.attach_volume_to_instance(self.VOLUME_NAME, instance_name)
        volumes_page.find_message_and_dismiss(messages.INFO)
        self.assertFalse(volumes_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(
            volumes_page.is_volume_status(self.VOLUME_NAME, 'In-use'))
        self.assertTrue(
            volumes_page.is_volume_attached_to_instance(
                self.VOLUME_NAME, instance_name))

        volumes_page.detach_volume_from_instance(self.VOLUME_NAME,
                                                 instance_name)
        volumes_page.find_message_and_dismiss(messages.SUCCESS)
        self.assertFalse(volumes_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(
            volumes_page.is_volume_status(self.VOLUME_NAME, 'Available'))

        volumes_page.delete_volume(self.VOLUME_NAME)
        volumes_page.find_message_and_dismiss(messages.SUCCESS)
        self.assertFalse(volumes_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(volumes_page.is_volume_deleted(self.VOLUME_NAME))

        instances_page = self.home_pg.go_to_compute_instancespage()
        instances_page.delete_instance(instance_name)
        instances_page.find_message_and_dismiss(messages.SUCCESS)
        self.assertFalse(
            instances_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(instances_page.is_instance_deleted(instance_name))
Пример #6
0
    def test_qos_spec_edit_consumer(self):
        """tests Edit Consumer of QoS Spec functionality

        * creates a new QoS Spec
        * verifies the QoS Spec appears in the QoS Specs table
        * edit consumer of created QoS Spec (check all options - front-end,
          both, back-end)
        * verifies current consumer of the QoS Spec in the QoS Specs table
        * deletes the newly created QoS Spec
        * verifies the QoS Spec does not appear in the table after deletion
        """
        qos_spec_name = helpers.gen_random_resource_name("qos_spec")
        qos_spec_page = self.home_pg.go_to_system_volumes_volumetypespage()
        nova_compute_consumer = 'front-end'
        both_consumers = 'both'
        cinder_consumer = 'back-end'

        qos_spec_page.create_qos_spec(qos_spec_name)
        self.assertTrue(
            qos_spec_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            qos_spec_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(qos_spec_page.is_qos_spec_present(qos_spec_name))

        qos_spec_page.edit_consumer(qos_spec_name, nova_compute_consumer)
        self.assertTrue(
            qos_spec_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            qos_spec_page.find_message_and_dismiss(messages.ERROR))
        self.assertEqual(
            qos_spec_page.get_consumer(qos_spec_name), nova_compute_consumer)

        qos_spec_page.edit_consumer(qos_spec_name, both_consumers)
        self.assertTrue(
            qos_spec_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            qos_spec_page.find_message_and_dismiss(messages.ERROR))
        self.assertEqual(
            qos_spec_page.get_consumer(qos_spec_name), both_consumers)

        qos_spec_page.edit_consumer(qos_spec_name, cinder_consumer)
        self.assertTrue(
            qos_spec_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            qos_spec_page.find_message_and_dismiss(messages.ERROR))
        self.assertEqual(
            qos_spec_page.get_consumer(qos_spec_name), cinder_consumer)

        qos_spec_page.delete_qos_specs(qos_spec_name)
        self.assertTrue(
            qos_spec_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            qos_spec_page.find_message_and_dismiss(messages.ERROR))
        self.assertFalse(qos_spec_page.is_qos_spec_present(qos_spec_name))
Пример #7
0
    def test_qos_spec_edit_consumer(self):
        """tests Edit Consumer of QoS Spec functionality

        * creates a new QoS Spec
        * verifies the QoS Spec appears in the QoS Specs table
        * edit consumer of created QoS Spec (check all options - front-end,
          both, back-end)
        * verifies current consumer of the QoS Spec in the QoS Specs table
        * deletes the newly created QoS Spec
        * verifies the QoS Spec does not appear in the table after deletion
        """
        qos_spec_name = helpers.gen_random_resource_name("qos_spec")
        qos_spec_page = self.home_pg.go_to_system_volumes_volumetypespage()
        nova_compute_consumer = 'front-end'
        both_consumers = 'both'
        cinder_consumer = 'back-end'

        qos_spec_page.create_qos_spec(qos_spec_name)
        self.assertTrue(
            qos_spec_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(qos_spec_page.find_message_and_dismiss(
            messages.ERROR))
        self.assertTrue(qos_spec_page.is_qos_spec_present(qos_spec_name))

        qos_spec_page.edit_consumer(qos_spec_name, nova_compute_consumer)
        self.assertTrue(
            qos_spec_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(qos_spec_page.find_message_and_dismiss(
            messages.ERROR))
        self.assertEqual(qos_spec_page.get_consumer(qos_spec_name),
                         nova_compute_consumer)

        qos_spec_page.edit_consumer(qos_spec_name, both_consumers)
        self.assertTrue(
            qos_spec_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(qos_spec_page.find_message_and_dismiss(
            messages.ERROR))
        self.assertEqual(qos_spec_page.get_consumer(qos_spec_name),
                         both_consumers)

        qos_spec_page.edit_consumer(qos_spec_name, cinder_consumer)
        self.assertTrue(
            qos_spec_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(qos_spec_page.find_message_and_dismiss(
            messages.ERROR))
        self.assertEqual(qos_spec_page.get_consumer(qos_spec_name),
                         cinder_consumer)

        qos_spec_page.delete_qos_specs(qos_spec_name)
        self.assertTrue(
            qos_spec_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(qos_spec_page.find_message_and_dismiss(
            messages.ERROR))
        self.assertFalse(qos_spec_page.is_qos_spec_present(qos_spec_name))
Пример #8
0
    def test_edit_image_description_and_name(self):
        """tests that image description is editable
        * creates image from locally downloaded file
        * verifies the image appears in the images table as active
        * toggle edit action and adds some description
        * verifies that edit action was successful
        * verifies that new description is seen on image details page
        * toggle edit action and changes image name
        * verifies that edit action was successful
        * verifies that image with new name is seen on the page
        * deletes the image
        * verifies the image does not appear in the table after deletion
        """
        new_description_text = helpers.gen_random_resource_name("description")
        new_image_name = helpers.gen_random_resource_name("image")
        with helpers.gen_temporary_file() as file_name:
            images_page = self.image_create(local_file=file_name)
            images_page.edit_image(self.IMAGE_NAME,
                                   description=new_description_text)
            self.assertTrue(
                images_page.find_message_and_dismiss(messages.SUCCESS))
            self.assertFalse(
                images_page.find_message_and_dismiss(messages.ERROR))

            results = images_page.check_image_details(
                self.IMAGE_NAME, {'Description': new_description_text})
            self.assertSequenceTrue(results)

            # Just go back to the images page and toggle edit again
            images_page = self.images_page
            images_page.edit_image(self.IMAGE_NAME, new_name=new_image_name)
            self.assertTrue(
                images_page.find_message_and_dismiss(messages.SUCCESS))
            self.assertFalse(
                images_page.find_message_and_dismiss(messages.ERROR))

            results = images_page.check_image_details(new_image_name,
                                                      {'Name': new_image_name})
            self.assertSequenceTrue(results)

            self.image_delete(new_image_name)
Пример #9
0
class TestAdminInstances(helpers.AdminTestCase, TestInstances):
    INSTANCE_NAME = helpers.gen_random_resource_name('instance',
                                                     timestamp=False)

    @property
    def instances_page(self):
        return self.home_pg.go_to_admin_compute_instancespage()

    @decorators.skip_because(bugs=['1774697'])
    def test_instances_pagination_and_filtration(self):
        super(TestAdminInstances, self).\
            test_instances_pagination_and_filtration()
Пример #10
0
    def test_floatingip_associate_disassociate(self):
        instance_name = helpers.gen_random_resource_name('instance',
                                                         timestamp=False)
        instances_page = self.home_pg.go_to_project_compute_instancespage()
        instances_page.create_instance(instance_name)
        self.assertTrue(
            instances_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            instances_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(instances_page.is_instance_active(instance_name))
        instance_ipv4 = instances_page.get_fixed_ipv4(instance_name)
        instance_info = "{} {}".format(instance_name, instance_ipv4)

        floatingip_page = \
            self.home_pg.go_to_project_network_floatingipspage()
        floating_ip = floatingip_page.allocate_floatingip()
        self.assertTrue(
            floatingip_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            floatingip_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(floatingip_page.is_floatingip_present(floating_ip))

        self.assertEqual('-', floatingip_page.get_fixed_ip(floating_ip))
        floatingip_page.associate_floatingip(floating_ip, instance_name,
                                             instance_ipv4)
        self.assertTrue(
            floatingip_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            floatingip_page.find_message_and_dismiss(messages.ERROR))
        self.assertEqual(instance_info,
                         floatingip_page.get_fixed_ip(floating_ip))

        floatingip_page.disassociate_floatingip(floating_ip)
        self.assertTrue(
            floatingip_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            floatingip_page.find_message_and_dismiss(messages.ERROR))
        self.assertEqual('-', floatingip_page.get_fixed_ip(floating_ip))

        floatingip_page.release_floatingip(floating_ip)
        self.assertTrue(
            floatingip_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            floatingip_page.find_message_and_dismiss(messages.ERROR))
        self.assertFalse(floatingip_page.is_floatingip_present(floating_ip))

        instances_page = self.home_pg.go_to_project_compute_instancespage()
        instances_page.delete_instance(instance_name)
        self.assertTrue(
            instances_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            instances_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(instances_page.is_instance_deleted(instance_name))
    def test_floatingip_associate_disassociate(self):
        instance_name = helpers.gen_random_resource_name('instance',
                                                         timestamp=False)
        instances_page = self.home_pg.go_to_compute_instancespage()
        instances_page.create_instance(instance_name)
        self.assertTrue(
            instances_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            instances_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(instances_page.is_instance_active(instance_name))
        instance_ipv4 = instances_page.get_fixed_ipv4(instance_name)
        instance_info = "{} {}".format(instance_name, instance_ipv4)

        floatingip_page = \
            self.home_pg.go_to_compute_accessandsecurity_floatingipspage()
        floating_ip = floatingip_page.allocate_floatingip()
        self.assertTrue(
            floatingip_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            floatingip_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(floatingip_page.is_floatingip_present(floating_ip))

        self.assertEqual(floatingip_page.get_fixed_ip(floating_ip), '-')
        floatingip_page.associate_floatingip(floating_ip, instance_name,
                                             instance_ipv4)
        self.assertTrue(
            floatingip_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            floatingip_page.find_message_and_dismiss(messages.ERROR))
        self.assertEqual(floatingip_page.get_fixed_ip(floating_ip),
                         instance_info)

        floatingip_page.disassociate_floatingip(floating_ip)
        self.assertTrue(
            floatingip_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            floatingip_page.find_message_and_dismiss(messages.ERROR))
        self.assertEqual(floatingip_page.get_fixed_ip(floating_ip), '-')

        floatingip_page.release_floatingip(floating_ip)
        self.assertTrue(
            floatingip_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            floatingip_page.find_message_and_dismiss(messages.ERROR))
        self.assertFalse(floatingip_page.is_floatingip_present(floating_ip))

        instances_page = self.home_pg.go_to_compute_instancespage()
        instances_page.delete_instance(instance_name)
        self.assertTrue(
            instances_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            instances_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(instances_page.is_instance_deleted(instance_name))
Пример #12
0
class TestAdminInstances(helpers.AdminTestCase, TestInstances):
    INSTANCE_NAME = helpers.gen_random_resource_name('instance',
                                                     timestamp=False)

    @property
    def instances_page(self):
        return self.home_pg.go_to_admin_compute_instancespage()

    @pytest.mark.skip(reason="Bug 1774697")
    def test_instances_pagination_and_filtration(self):
        super(TestAdminInstances, self).\
            test_instances_pagination_and_filtration()
Пример #13
0
class TestRouters(helpers.TestCase):
    ROUTER_NAME = helpers.gen_random_resource_name("router")

    @decorators.services_required("neutron")
    def test_router_create(self):
        """Checks create, clear/set gateway, delete router functionality

        Executed by non-admin user.

        Steps:
        1. Login to Horizon Dashboard as horizon user
        2. Navigate to Project -> Network -> Routers page
        3. Create new router
        4. Check that the router appears in the routers table as active
        5. Check that no Error messages present
        6. Clear the gateway
        7. Check that the router is still in the routers table
           with no external network
        8. Check that no Error messages present
        9. Set the gateway to 'public' network
        10. Check that no Error messages present
        11. Check that router's external network is set to 'public'
        12. Delete the router
        13. Check that the router is absent in the routers table
        14. Check that no Error messages present
        """

        routers_page = self.home_pg.go_to_network_routerspage()

        routers_page.create_router(self.ROUTER_NAME)
        self.assertTrue(routers_page.find_message_and_dismiss(
            messages.SUCCESS))
        self.assertFalse(routers_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(routers_page.is_router_present(self.ROUTER_NAME))
        self.assertTrue(routers_page.is_router_active(self.ROUTER_NAME))

        routers_page.clear_gateway(self.ROUTER_NAME)
        self.assertTrue(routers_page.find_message_and_dismiss(
            messages.SUCCESS))
        self.assertFalse(routers_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(routers_page.is_gateway_cleared(self.ROUTER_NAME))

        routers_page.set_gateway(self.ROUTER_NAME)
        self.assertTrue(routers_page.find_message_and_dismiss(
            messages.SUCCESS))
        self.assertFalse(routers_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(routers_page.is_gateway_set(self.ROUTER_NAME))

        routers_page.delete_router(self.ROUTER_NAME)
        self.assertTrue(routers_page.find_message_and_dismiss(
            messages.SUCCESS))
        self.assertFalse(routers_page.find_message_and_dismiss(messages.ERROR))
        self.assertFalse(routers_page.is_router_present(self.ROUTER_NAME))
Пример #14
0
class TestUser(helpers.AdminTestCase):

    USER_NAME = helpers.gen_random_resource_name("user")

    def test_create_delete_user(self):
        users_page = self.home_pg.go_to_identity_userspage()
        password = self.TEST_PASSWORD
        users_page.create_user(self.USER_NAME, password=password,
                               project='admin', role='admin')
        self.assertTrue(users_page.is_user_present(self.USER_NAME))
        users_page.delete_user(self.USER_NAME)
        self.assertFalse(users_page.is_user_present(self.USER_NAME))
Пример #15
0
class TestKeypair(helpers.TestCase):
    """Checks that the user is able to create/delete keypair."""
    KEYPAIR_NAME = helpers.gen_random_resource_name("keypair")

    def test_keypair(self):
        keypair_page = self.home_pg.go_to_accessandsecurity_keypairspage()
        keypair_page.create_keypair(self.KEYPAIR_NAME)

        keypair_page = self.home_pg.go_to_accessandsecurity_keypairspage()
        self.assertTrue(keypair_page.is_keypair_present(self.KEYPAIR_NAME))

        keypair_page.delete_keypair(self.KEYPAIR_NAME)
        self.assertFalse(keypair_page.is_keypair_present(self.KEYPAIR_NAME))
Пример #16
0
class TestStacks(helpers.AdminTestCase):
    KEYPAIR_NAME = 'keypair_for_stack'
    STACKS_NAME = helpers.gen_random_resource_name('stack', timestamp=False)
    STACK_TEMPLATE_PATH = os.path.join(os.path.dirname(__file__),
                                       'test-data/stack_template')

    def setUp(self):
        super(TestStacks, self).setUp()
        keypair_page = self.home_pg.\
            go_to_compute_accessandsecurity_keypairspage()
        keypair_page.create_keypair(self.KEYPAIR_NAME)
        keypair_page = self.home_pg.\
            go_to_compute_accessandsecurity_keypairspage()
        self.assertTrue(keypair_page.is_keypair_present(self.KEYPAIR_NAME))

        def cleanup():
            keypair_page = self.home_pg.\
                go_to_compute_accessandsecurity_keypairspage()
            keypair_page.delete_keypairs(self.KEYPAIR_NAME)
            keypair_page.find_message_and_dismiss(messages.SUCCESS)

        self.addCleanup(cleanup)

    @decorators.skip_because(bugs=['1584057'])
    @decorators.services_required("heat")
    def test_create_delete_stack(self):
        """tests the stack creation and deletion functionality

        * creates a new stack
        * verifies the stack appears in the stacks table in Create Complete
          state
        * deletes the newly created stack
        * verifies the stack does not appear in the table after deletion
        """
        with open(self.STACK_TEMPLATE_PATH, 'r') as f:
            template = f.read()
        input_template = template.format(self.KEYPAIR_NAME,
                                         self.CONFIG.image.images_list[0],
                                         "public")
        stacks_page = self.home_pg.go_to_orchestration_stackspage()

        stacks_page.create_stack(self.STACKS_NAME, input_template)
        self.assertTrue(stacks_page.find_message_and_dismiss(messages.INFO))
        self.assertFalse(stacks_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(stacks_page.is_stack_present(self.STACKS_NAME))
        self.assertTrue(stacks_page.is_stack_create_complete(self.STACKS_NAME))

        stacks_page.delete_stack(self.STACKS_NAME)
        self.assertTrue(stacks_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(stacks_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(stacks_page.is_stack_deleted(self.STACKS_NAME))
Пример #17
0
class TestFlavors(helpers.AdminTestCase):
    FLAVOR_NAME = helpers.gen_random_resource_name("flavor")

    def setUp(self):
        super(TestFlavors, self).setUp()
        self.flavors_page = self.home_pg.go_to_admin_compute_flavorspage()

    def _create_flavor(self, flavor_name):
        self.flavors_page.create_flavor(name=flavor_name,
                                        vcpus=1,
                                        ram=1024,
                                        root_disk=20,
                                        ephemeral_disk=0,
                                        swap_disk=0)
        self.assertTrue(
            self.flavors_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            self.flavors_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(self.flavors_page.is_flavor_present(self.FLAVOR_NAME))

    def _delete_flavor(self, flavor_name):
        self.flavors_page.delete_flavor_by_row(flavor_name)
        self.assertTrue(
            self.flavors_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            self.flavors_page.find_message_and_dismiss(messages.ERROR))
        self.assertFalse(self.flavors_page.is_flavor_present(self.FLAVOR_NAME))

    def test_flavor_header(self):
        header_text = self.driver.find_element_by_tag_name('h1').text
        self.assertEqual(header_text, 'Flavors')

    def test_flavor_module_exists(self):
        js_cmd = "$('html').append('<div id=\"testonly\">'"\
            " + angular.module('horizon.app.core.flavors').name"\
            " + '</div>');"
        self.driver.execute_script(js_cmd)
        value = self.driver.find_element_by_id('testonly').text
        self.assertEqual(value, 'horizon.app.core.flavors')

    def test_flavor_create(self):
        """tests the flavor creation and deletion functionalities:

        * creates a new flavor
        * verifies the flavor appears in the flavors table
        * deletes the newly created flavor
        * verifies the flavor does not appear in the table after deletion
        """
        self._create_flavor(self.FLAVOR_NAME)
        self._delete_flavor(self.FLAVOR_NAME)
Пример #18
0
    def test_update_image_metadata(self):
        """Test update image metadata
        * logs in as admin user
        * creates image from locally downloaded file
        * verifies the image appears in the images table as active
        * invokes action 'Update Metadata' for the image
        * adds custom filed 'metadata'
        * adds value 'image' for the custom filed 'metadata'
        * gets the actual description of the image
        * verifies that custom filed is present in the image description
        * deletes the image
        * verifies the image does not appear in the table after deletion
        """
        new_metadata = {'metadata1': helpers.gen_random_resource_name("value"),
                        'metadata2': helpers.gen_random_resource_name("value")}

        with helpers.gen_temporary_file() as file_name:
            images_page = self.image_create(local_file=file_name)
            images_page.add_custom_metadata(self.IMAGE_NAME, new_metadata)
            results = images_page.check_image_details(self.IMAGE_NAME,
                                                      new_metadata)
            self.image_delete()
            self.assertSequenceTrue(results)  # custom matcher
Пример #19
0
class TestAdminVolumes(helpers.AdminTestCase):
    VOLUME_NAME = helpers.gen_random_resource_name("volume")

    def test_volume_create_edit_delete_through_admin(self):
        """This test case checks create, edit, delete volume functionality
            executed by admin user:
            Steps:
            1. Login to Horizon Dashboard as admin user
            2. Navigate to Project -> Compute -> Volumes page
            3. Create new volume
            4. Check that the volume is in the list
            5. Check that no Error messages present
            6. Edit the volume
            7. Check that the volume is still in the list
            8. Check that no Error messages present
            9. Go to Admin/System/Volumes page
            10. Delete the volume
            11. Check that the volume is absent in the list
            12. Check that no Error messages present
        """
        volumes_page = self.home_pg.go_to_compute_volumes_volumespage()

        volumes_page.create_volume(self.VOLUME_NAME)
        self.assertTrue(
            volumes_page.find_message_and_dismiss(messages.INFO))
        self.assertFalse(
            volumes_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(volumes_page.is_volume_present(self.VOLUME_NAME))
        self.assertTrue(volumes_page.is_volume_status(self.VOLUME_NAME,
                                                      'Available'))

        new_name = "edited_" + self.VOLUME_NAME
        volumes_page.edit_volume(self.VOLUME_NAME, new_name, "description")
        self.VOLUME_NAME = new_name
        self.assertTrue(
            volumes_page.find_message_and_dismiss(messages.INFO))
        self.assertFalse(
            volumes_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(volumes_page.is_volume_present(self.VOLUME_NAME))
        self.assertTrue(volumes_page.is_volume_status(self.VOLUME_NAME,
                                                      'Available'))

        volumes_admin_page = self.home_pg.go_to_system_volumes_volumespage()

        volumes_admin_page.delete_volume(self.VOLUME_NAME)
        self.assertTrue(
            volumes_admin_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            volumes_admin_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(volumes_admin_page.is_volume_deleted(self.VOLUME_NAME))
Пример #20
0
class TestAdminRouters(helpers.AdminTestCase):
    ROUTER_NAME = helpers.gen_random_resource_name("router")

    @decorators.skip_because(bugs=['1792028'])
    @decorators.services_required("neutron")
    def test_router_create_admin(self):
        """tests the router creation and deletion functionalities:

        * creates a new router for public network
        * verifies the router appears in the routers table as active
        * edits router name
        * checks router name was updated properly
        * deletes the newly created router
        * verifies the router does not appear in the table after deletion
        """
        routers_page = self.home_pg.go_to_project_network_routerspage()

        routers_page.create_router(self.ROUTER_NAME)
        self.assertTrue(routers_page.find_message_and_dismiss(
            messages.SUCCESS))
        self.assertFalse(routers_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(routers_page.is_router_present(self.ROUTER_NAME))
        self.assertTrue(routers_page.is_router_active(self.ROUTER_NAME))

        self.home_pg.go_to_admin_overviewpage()
        admin_routers_page = self.home_pg.go_to_admin_network_routerspage()
        self.assertTrue(routers_page.is_router_present(self.ROUTER_NAME))
        self.assertTrue(routers_page.is_router_active(self.ROUTER_NAME))

        new_name = "edited_" + self.ROUTER_NAME
        admin_routers_page.edit_router(self.ROUTER_NAME, new_name=new_name)
        self.assertTrue(
            admin_routers_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            admin_routers_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(admin_routers_page.is_router_present(new_name))
        self.assertTrue(admin_routers_page.is_router_active(new_name))

        admin_routers_page.delete_router(new_name)
        self.assertTrue(
            admin_routers_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            admin_routers_page.find_message_and_dismiss(messages.ERROR))
        self.assertFalse(admin_routers_page.is_router_present(new_name))
Пример #21
0
class TestImage(helpers.TestCase):
    IMAGE_NAME = helpers.gen_random_resource_name("image")

    def test_image_create_delete(self):
        """tests the image creation and deletion functionalities:
        * creates a new image from horizon.conf http_image
        * verifies the image appears in the images table as active
        * deletes the newly created image
        * verifies the image does not appear in the table after deletion
        """

        images_page = self.home_pg.go_to_compute_imagespage()

        images_page.create_image(self.IMAGE_NAME)
        self.assertTrue(images_page.is_image_present(self.IMAGE_NAME))
        self.assertTrue(images_page.is_image_active(self.IMAGE_NAME))

        images_page.delete_image(self.IMAGE_NAME)
        self.assertFalse(images_page.is_image_present(self.IMAGE_NAME))
Пример #22
0
class TestFlavors(helpers.AdminTestCase):
    FLAVOR_NAME = helpers.gen_random_resource_name("flavor")

    def test_flavor_create(self):
        """tests the flavor creation and deletion functionalities:
        * creates a new flavor
        * verifies the flavor appears in the flavors table
        * deletes the newly created flavor
        * verifies the flavor does not appear in the table after deletion
        """

        flavors_page = self.home_pg.go_to_system_flavorspage()

        flavors_page.create_flavor(name=self.FLAVOR_NAME, vcpus=1, ram=1024,
                                   root_disk=20, ephemeral_disk=0,
                                   swap_disk=0)
        self.assertTrue(flavors_page.is_flavor_present(self.FLAVOR_NAME))

        flavors_page.delete_flavor(self.FLAVOR_NAME)
        self.assertFalse(flavors_page.is_flavor_present(self.FLAVOR_NAME))
Пример #23
0
class TestKeypair(helpers.TestCase):
    """Checks that the user is able to create/delete keypair."""
    KEYPAIR_NAME = helpers.gen_random_resource_name("keypair")

    @decorators.skip_because(bugs=['1774697'])
    def test_keypair(self):
        keypair_page = self.home_pg.\
            go_to_project_compute_keypairspage()
        keypair_page.create_keypair(self.KEYPAIR_NAME)
        self.assertFalse(keypair_page.find_message_and_dismiss(messages.ERROR))

        keypair_page = self.home_pg.\
            go_to_project_compute_keypairspage()
        self.assertTrue(keypair_page.is_keypair_present(self.KEYPAIR_NAME))

        keypair_page.delete_keypair(self.KEYPAIR_NAME)
        self.assertTrue(keypair_page.find_message_and_dismiss(
            messages.SUCCESS))
        self.assertFalse(keypair_page.find_message_and_dismiss(messages.ERROR))
        self.assertFalse(keypair_page.is_keypair_present(self.KEYPAIR_NAME))
Пример #24
0
class TestKeypair(helpers.TestCase):
    """Checks that the user is able to create/delete keypair."""
    KEYPAIR_NAME = helpers.gen_random_resource_name("keypair")

    @pytest.mark.skip(reason="Legacy Panel not tested")
    def test_keypair(self):
        keypair_page = self.home_pg.\
            go_to_project_compute_keypairspage()
        keypair_page.create_keypair(self.KEYPAIR_NAME)
        self.assertFalse(keypair_page.find_message_and_dismiss(messages.ERROR))

        keypair_page = self.home_pg.\
            go_to_project_compute_keypairspage()
        self.assertTrue(keypair_page.is_keypair_present(self.KEYPAIR_NAME))

        keypair_page.delete_keypair(self.KEYPAIR_NAME)
        self.assertTrue(keypair_page.find_message_and_dismiss(
            messages.SUCCESS))
        self.assertFalse(keypair_page.find_message_and_dismiss(messages.ERROR))
        self.assertFalse(keypair_page.is_keypair_present(self.KEYPAIR_NAME))
Пример #25
0
class TestUser(helpers.AdminTestCase):

    USER_NAME = helpers.gen_random_resource_name("user")

    @decorators.skip_because(bugs=['1774697'])
    def test_create_delete_user(self):
        users_page = self.home_pg.go_to_identity_userspage()
        password = self.TEST_PASSWORD

        users_page.create_user(self.USER_NAME,
                               password=password,
                               project='admin',
                               role='admin')
        self.assertTrue(users_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(users_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(users_page.is_user_present(self.USER_NAME))

        users_page.delete_user(self.USER_NAME)
        self.assertTrue(users_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(users_page.find_message_and_dismiss(messages.ERROR))
        self.assertFalse(users_page.is_user_present(self.USER_NAME))
    def test_create_distributed_router(self):
        router_name = helpers.gen_random_resource_name("router")
        routers_page = self.home_pg.go_to_network_routerspage()
        routers_page.create_router(router_name,
                                   admin_state_up=None,
                                   external_network=None)
        self.assertTrue(
            routers_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(routers_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(routers_page.is_router_present(router_name))
        self.assertTrue(routers_page.is_router_active(router_name))

        self.home_pg.log_out()
        self.home_pg = self.login_pg.login(self.ADMIN_NAME,
                                           self.ADMIN_PASSWORD)
        self.home_pg.change_project(self.ADMIN_PROJECT)

        routers_page = self.home_pg.go_to_system_routerspage()

        def delete_router():
            routers_page.delete_router(router_name)
            self.assertTrue(
                routers_page.find_message_and_dismiss(messages.SUCCESS))
            self.assertFalse(
                routers_page.find_message_and_dismiss(messages.ERROR))
            self.assertFalse(routers_page.is_router_present(router_name))

        try:
            router_info = routers_page.get_router_info(router_name)
        except KeyError as e:
            if e.args[0] == 'mode':
                routers_page.refresh_page()
                delete_router()
                self.skipTest("Distributed mode is not supported")
            else:
                raise

        self.assertEqual(router_info['mode'], 'distributed')
        delete_router()
Пример #27
0
class TestImagesAdmin(helpers.AdminTestCase, TestImagesBasic):
    """Login as admin user"""
    IMAGE_NAME = helpers.gen_random_resource_name("image")

    @property
    def images_page(self):
        return self.home_pg.go_to_system_imagespage()

    @decorators.skip_because(bugs=['1584057'])
    def test_image_create_delete(self):
        super(TestImagesAdmin, self).test_image_create_delete()

    def test_filter_images(self):
        """This test checks filtering of images
            Steps:
            1) Login to Horizon dashboard as admin user
            2) Go to Admin -> System -> Images
            3) Use filter by Image Name
            4) Check that filtered table has one image only (which name is
            equal to filter value)
            5) Check that no other images in the table
            6) Clear filter and set nonexistent image name. Check that 0 rows
            are displayed
        """
        images_list = self.CONFIG.image.images_list
        images_page = self.images_page

        images_page.images_table.filter(images_list[0])
        self.assertTrue(images_page.is_image_present(images_list[0]))
        for image in images_list[1:]:
            self.assertFalse(images_page.is_image_present(image))

        nonexistent_image_name = "{0}_test".format(self.IMAGE_NAME)
        images_page.images_table.filter(nonexistent_image_name)
        self.assertEqual(images_page.images_table.rows, [])

        images_page.images_table.filter('')
Пример #28
0
class TestRouters(helpers.TestCase):
    ROUTER_NAME = helpers.gen_random_resource_name("router")

    def test_router_create(self):
        """tests the router creation and deletion functionalities:
        * creates a new router for public network
        * verifies the router appears in the routers table as active
        * deletes the newly created router
        * verifies the router does not appear in the table after deletion
        """
        routers_page = self.home_pg.go_to_network_routerspage()

        routers_page.create_router(self.ROUTER_NAME)
        self.assertTrue(routers_page.find_message_and_dismiss(
            messages.SUCCESS))
        self.assertFalse(routers_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(routers_page.is_router_present(self.ROUTER_NAME))
        self.assertTrue(routers_page.is_router_active(self.ROUTER_NAME))

        routers_page.delete_router(self.ROUTER_NAME)
        self.assertTrue(routers_page.find_message_and_dismiss(
            messages.SUCCESS))
        self.assertFalse(routers_page.find_message_and_dismiss(messages.ERROR))
        self.assertFalse(routers_page.is_router_present(self.ROUTER_NAME))
Пример #29
0
class TestSecuritygroup(helpers.TestCase):
    SECURITYGROUP_NAME = helpers.gen_random_resource_name("securitygroup")

    def test_securitygroup_create_delete(self):
        """tests the security group creation and deletion functionalities:
        * creates a new security group
        * verifies the security group appears in the security groups table
        * deletes the newly created security group
        * verifies the security group does not appear in the table after
        deletion
        """

        securitygroups_page = \
            self.home_pg.go_to_compute_accessandsecurity_securitygroupspage()

        securitygroups_page.create_securitygroup(self.SECURITYGROUP_NAME)
        self.assertTrue(
            securitygroups_page.is_securitygroup_present(
                self.SECURITYGROUP_NAME))

        securitygroups_page.delete_securitygroup(self.SECURITYGROUP_NAME)
        self.assertFalse(
            securitygroups_page.is_securitygroup_present(
                self.SECURITYGROUP_NAME))
Пример #30
0
 def group_description(self):
     return helpers.gen_random_resource_name('description')
Пример #31
0
class TestImagesAdvanced(helpers.TestCase):
    """Login as demo user"""
    IMAGE_NAME = helpers.gen_random_resource_name("image")

    @property
    def images_page(self):
        return self.home_pg.go_to_compute_imagespage()

    def test_create_volume_from_image(self):
        """This test case checks create volume from image functionality:
            Steps:
            1. Login to Horizon Dashboard as regular user
            2. Navigate to Project -> Compute -> Images
            3. Create new volume from image
            4. Check that volume is created with expected name
            5. Check that volume status is Available
        """
        images_page = self.images_page
        source_image = self.CONFIG.image.images_list[0]
        target_volume = "created_from_{0}".format(source_image)

        volumes_page = images_page.create_volume_from_image(
            source_image, volume_name=target_volume)
        self.assertTrue(volumes_page.find_message_and_dismiss(messages.INFO))
        self.assertFalse(volumes_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(volumes_page.is_volume_present(target_volume))
        self.assertTrue(
            volumes_page.is_volume_status(target_volume, 'Available'))
        volumes_page.delete_volume(target_volume)
        volumes_page.find_message_and_dismiss(messages.SUCCESS)
        volumes_page.find_message_and_dismiss(messages.ERROR)
        self.assertTrue(volumes_page.is_volume_deleted(target_volume))

    def test_launch_instance_from_image(self):
        """This test case checks launch instance from image functionality:
            Steps:
            1. Login to Horizon Dashboard as regular user
            2. Navigate to Project -> Compute -> Images
            3. Launch new instance from image
            4. Check that instance is create
            5. Check that status of newly created instance is Active
            6. Check that image_name in correct in instances table
        """
        images_page = self.images_page
        source_image = self.CONFIG.image.images_list[0]
        target_instance = "created_from_{0}".format(source_image)
        instances_page = images_page.launch_instance_from_image(
            source_image, target_instance)
        self.assertTrue(
            instances_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            instances_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(instances_page.is_instance_active(target_instance))
        actual_image_name = instances_page.get_image_name(target_instance)
        self.assertEqual(source_image, actual_image_name)

        instances_page.delete_instance(target_instance)
        self.assertTrue(
            instances_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            instances_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(instances_page.is_instance_deleted(target_instance))
Пример #32
0
class TestImagesBasic(helpers.TestCase):
    """Login as demo user"""
    IMAGE_NAME = helpers.gen_random_resource_name("image")

    @property
    def images_page(self):
        return self.home_pg.go_to_compute_imagespage()

    def image_create(self, local_file=None):
        images_page = self.images_page
        if local_file:
            images_page.create_image(self.IMAGE_NAME,
                                     image_source_type='file',
                                     image_file=local_file)
        else:
            images_page.create_image(self.IMAGE_NAME)
        self.assertTrue(images_page.find_message_and_dismiss(messages.INFO))
        self.assertFalse(images_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(images_page.is_image_present(self.IMAGE_NAME))
        self.assertTrue(images_page.is_image_active(self.IMAGE_NAME))
        return images_page

    def image_delete(self):
        images_page = self.images_page
        images_page.delete_image(self.IMAGE_NAME)
        self.assertTrue(images_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(images_page.find_message_and_dismiss(messages.ERROR))
        self.assertFalse(images_page.is_image_present(self.IMAGE_NAME))

    def test_image_create_delete(self):
        """tests the image creation and deletion functionalities:
        * creates a new image from horizon.conf http_image
        * verifies the image appears in the images table as active
        * deletes the newly created image
        * verifies the image does not appear in the table after deletion
        """
        self.image_create()
        self.image_delete()

    def test_image_create_delete_from_local_file(self):
        """tests the image creation and deletion functionalities:
        * downloads image from horizon.conf stated in http_image
        * creates the image from the downloaded file
        * verifies the image appears in the images table as active
        * deletes the newly created image
        * verifies the image does not appear in the table after deletion
        """
        with helpers.gen_temporary_file() as file_name:
            self.image_create(local_file=file_name)
            self.image_delete()

    def test_images_pagination(self):
        """This test checks images pagination
            Steps:
            1) Login to Horizon Dashboard as horizon user
            2) Navigate to user settings page
            3) Change 'Items Per Page' value to 1
            4) Go to Project -> Compute -> Images page
            5) Check that only 'Next' link is available, only one image is
            available (and it has correct name)
            6) Click 'Next' and check that both 'Prev' and 'Next' links are
            available, only one image is available (and it has correct name)
            7) Click 'Next' and check that only 'Prev' link is available,
            only one image is visible (and it has correct name)
            8) Click 'Prev' and check results (should be the same as for step6)
            9) Click 'Prev' and check results (should be the same as for step5)
            10) Go to user settings page and restore 'Items Per Page'
        """
        default_image_list = self.CONFIG.image.images_list
        items_per_page = 1
        first_page_definition = {
            'Next': True,
            'Prev': False,
            'Count': items_per_page,
            'Names': [default_image_list[0]]
        }
        second_page_definition = {
            'Next': True,
            'Prev': True,
            'Count': items_per_page,
            'Names': [default_image_list[1]]
        }
        third_page_definition = {
            'Next': False,
            'Prev': True,
            'Count': items_per_page,
            'Names': [default_image_list[2]]
        }

        settings_page = self.home_pg.go_to_settings_usersettingspage()
        settings_page.change_pagesize(items_per_page)
        settings_page.find_message_and_dismiss(messages.SUCCESS)

        images_page = self.images_page
        images_page.images_table.assert_definition(first_page_definition)

        images_page.images_table.turn_next_page()
        images_page.images_table.assert_definition(second_page_definition)

        images_page.images_table.turn_next_page()
        images_page.images_table.assert_definition(third_page_definition)

        images_page.images_table.turn_prev_page()
        images_page.images_table.assert_definition(second_page_definition)

        images_page.images_table.turn_prev_page()
        images_page.images_table.assert_definition(first_page_definition)

        settings_page = self.home_pg.go_to_settings_usersettingspage()
        settings_page.change_pagesize()
        settings_page.find_message_and_dismiss(messages.SUCCESS)

    def test_update_image_metadata(self):
        """Test update image metadata
        * logs in as admin user
        * creates image from locally downloaded file
        * verifies the image appears in the images table as active
        * invokes action 'Update Metadata' for the image
        * adds custom filed 'metadata'
        * adds value 'image' for the custom filed 'metadata'
        * gets the actual description of the image
        * verifies that custom filed is present in the image description
        * deletes the image
        * verifies the image does not appear in the table after deletion
        """
        new_metadata = {
            'metadata1': helpers.gen_random_resource_name("value"),
            'metadata2': helpers.gen_random_resource_name("value")
        }

        with helpers.gen_temporary_file() as file_name:
            images_page = self.image_create(local_file=file_name)
            images_page.add_custom_metadata(self.IMAGE_NAME, new_metadata)
            results = images_page.check_image_details(self.IMAGE_NAME,
                                                      new_metadata)
            self.image_delete()
            self.assertSequenceTrue(results)  # custom matcher

    def test_remove_protected_image(self):
        """tests that protected image is not deletable
        * logs in as admin user
        * creates image from locally downloaded file
        * verifies the image appears in the images table as active
        * marks 'Protected' checkbox
        * verifies that edit action was successful
        * verifies that delete action is not available in the list
        * tries to delete the image
        * verifies that exception is generated for the protected image
        * unmarks 'Protected' checkbox
        * deletes the image
        * verifies the image does not appear in the table after deletion
        """
        with helpers.gen_temporary_file() as file_name:
            images_page = self.image_create(local_file=file_name)
            images_page.edit_image(self.IMAGE_NAME, protected=True)
            self.assertTrue(
                images_page.find_message_and_dismiss(messages.SUCCESS))

            # Check that Delete action is not available in the action list.
            # The below action will generate exception since the bind fails.
            # But only ValueError with message below is expected here.
            with self.assertRaisesRegexp(ValueError, 'Could not bind method'):
                images_page.delete_image_via_row_action(self.IMAGE_NAME)

            # Try to delete image. That should not be possible now.
            images_page.delete_image(self.IMAGE_NAME)
            self.assertFalse(
                images_page.find_message_and_dismiss(messages.SUCCESS))
            self.assertTrue(
                images_page.find_message_and_dismiss(messages.ERROR))
            self.assertTrue(images_page.is_image_present(self.IMAGE_NAME))

            images_page.edit_image(self.IMAGE_NAME, protected=False)
            self.assertTrue(
                images_page.find_message_and_dismiss(messages.SUCCESS))
            self.image_delete()
Пример #33
0
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.
from openstack_dashboard.test.integration_tests import helpers

INSTANCES_NAME = helpers.gen_random_resource_name('instance',
                                                  timestamp=False)


class TestInstances(helpers.AdminTestCase):
    """This is a basic scenario to test:
    * Create Instance and Delete Instance
    """

    def test_create_delete_instance(self):
        instances_page = self.home_pg.go_to_compute_instancespage()
        instances_page.create_instance(INSTANCES_NAME)
        self.assertTrue(instances_page.is_instance_active(INSTANCES_NAME))
        instances_page.delete_instance(INSTANCES_NAME)
        self.assertTrue(instances_page.is_instance_deleted(INSTANCES_NAME))
 def project_name(self):
     return helpers.gen_random_resource_name("project")
class TestVolumeSnapshotsAdvanced(helpers.TestCase):
    """Login as demo user"""
    VOLUME_NAME = helpers.gen_random_resource_name("volume")
    VOLUME_SNAPSHOT_NAME = helpers.gen_random_resource_name("volume_snapshot")

    @property
    def volumes_snapshot_page(self):
        return self.home_pg.go_to_project_volumes_snapshotspage()

    def setUp(self):
        """Setup: create volume"""
        super(TestVolumeSnapshotsAdvanced, self).setUp()
        volumes_page = self.home_pg.go_to_project_volumes_volumespage()
        volumes_page.create_volume(self.VOLUME_NAME)
        volumes_page.find_message_and_dismiss(messages.INFO)
        self.assertTrue(volumes_page.is_volume_status(self.VOLUME_NAME,
                                                      'Available'))

        def cleanup():
            volumes_page = self.home_pg.go_to_project_volumes_volumespage()
            volumes_page.delete_volume(self.VOLUME_NAME)
            self.assertTrue(
                volumes_page.find_message_and_dismiss(messages.SUCCESS))
            self.assertFalse(
                volumes_page.find_message_and_dismiss(messages.ERROR))
            self.assertTrue(volumes_page.is_volume_deleted(self.VOLUME_NAME))

        self.addCleanup(cleanup)

    def test_create_volume_from_snapshot(self):
        """Test checks possibility to create volume from snapshot

        Steps:
        1. Login to Horizon Dashboard as regular user
        2. Navigate to Project -> Volumes -> Volumes page
        3. Create snapshot for existed volume
        4. Create new volume from snapshot
        5. Check the volume is created and has 'Available' status
        6. Delete volume snapshot
        7. Delete volume
        """
        volumes_page = self.home_pg.go_to_project_volumes_volumespage()
        volumes_snapshot_page = volumes_page.create_volume_snapshot(
            self.VOLUME_NAME, self.VOLUME_SNAPSHOT_NAME)
        self.assertTrue(volumes_page.find_message_and_dismiss(messages.INFO))
        self.assertFalse(volumes_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(volumes_snapshot_page.is_volume_snapshot_available(
            self.VOLUME_SNAPSHOT_NAME))

        new_volume = 'new_' + self.VOLUME_NAME
        volumes_snapshot_page.create_volume_from_snapshot(
            self.VOLUME_SNAPSHOT_NAME, new_volume)
        self.assertTrue(volumes_page.is_volume_present(new_volume))
        self.assertTrue(volumes_page.is_volume_status(new_volume, 'Available'))

        volumes_snapshot_page = self.volumes_snapshot_page
        volumes_snapshot_page.delete_volume_snapshot(self.VOLUME_SNAPSHOT_NAME)
        self.assertTrue(
            volumes_snapshot_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            volumes_snapshot_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(volumes_snapshot_page.is_volume_snapshot_deleted(
            self.VOLUME_SNAPSHOT_NAME))

        volumes_page = self.home_pg.go_to_project_volumes_volumespage()
        volumes_page.delete_volume(new_volume)
        self.assertTrue(
            volumes_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(volumes_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(volumes_page.is_volume_deleted(new_volume))
class TestVolumeSnapshotsBasic(helpers.TestCase):
    """Login as demo user"""
    VOLUME_NAME = helpers.gen_random_resource_name("volume")
    VOLUME_SNAPSHOT_NAME = helpers.gen_random_resource_name("volume_snapshot")

    @property
    def volumes_snapshot_page(self):
        return self.home_pg.go_to_project_volumes_snapshotspage()

    def setUp(self):
        """Setup: create volume"""
        super(TestVolumeSnapshotsBasic, self).setUp()
        volumes_page = self.home_pg.go_to_project_volumes_volumespage()
        volumes_page.create_volume(self.VOLUME_NAME)
        volumes_page.find_message_and_dismiss(messages.INFO)
        self.assertTrue(volumes_page.is_volume_status(self.VOLUME_NAME,
                                                      'Available'))

        def cleanup():
            volumes_page = self.home_pg.go_to_project_volumes_volumespage()
            volumes_page.delete_volume(self.VOLUME_NAME)
            volumes_page.find_message_and_dismiss(messages.SUCCESS)
            self.assertTrue(volumes_page.is_volume_deleted(self.VOLUME_NAME))

        self.addCleanup(cleanup)

    def test_create_edit_delete_volume_snapshot(self):
        """Test checks create/delete volume snapshot action

        Steps:
        1. Login to Horizon Dashboard
        2. Navigate to Project -> Volumes -> Volumes page
        3. Create snapshot for existed volume
        4. Check that no ERROR appears
        5. Check that snapshot is in the list
        6. Check that snapshot has reference to correct volume
        7. Edit snapshot name and description
        8. Delete volume snapshot from proper page
        9. Check that volume snapshot not in the list
        """
        volumes_page = self.home_pg.go_to_project_volumes_volumespage()
        volumes_snapshot_page = volumes_page.create_volume_snapshot(
            self.VOLUME_NAME, self.VOLUME_SNAPSHOT_NAME)
        self.assertTrue(volumes_page.find_message_and_dismiss(messages.INFO))
        self.assertFalse(volumes_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(volumes_snapshot_page.is_volume_snapshot_available(
            self.VOLUME_SNAPSHOT_NAME))
        actual_volume_name = volumes_snapshot_page.get_volume_name(
            self.VOLUME_SNAPSHOT_NAME)
        self.assertEqual(self.VOLUME_NAME, actual_volume_name)

        new_name = "new_" + self.VOLUME_SNAPSHOT_NAME
        volumes_snapshot_page = \
            self.home_pg.go_to_project_volumes_snapshotspage()
        volumes_snapshot_page.edit_snapshot(self.VOLUME_SNAPSHOT_NAME,
                                            new_name, "description")
        self.assertTrue(
            volumes_snapshot_page.find_message_and_dismiss(messages.INFO))
        self.assertFalse(
            volumes_snapshot_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(volumes_snapshot_page.
                        is_volume_snapshot_available(new_name))

        volumes_snapshot_page.delete_volume_snapshot(new_name)
        self.assertTrue(
            volumes_snapshot_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            volumes_snapshot_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(volumes_snapshot_page.is_volume_snapshot_deleted(
            new_name))

    def test_volume_snapshots_pagination(self):
        """This test checks volumes snapshots pagination

        Steps:
        1) Login to Horizon Dashboard
        2) Go to Project -> Volumes -> Volumes tab, create
           volumes and 3 snapshots
        3) Navigate to user settings page
        4) Change 'Items Per Page' value to 1
        5) Go to Project -> Volumes -> Snapshots tab
           or Admin -> Volume -> Snapshots tab
           (depends on user)
        6) Check that only 'Next' link is available, only one snapshot is
           available (and it has correct name)
        7) Click 'Next' and check that both 'Prev' and 'Next' links are
           available, only one snapshot is available (and it has correct name)
        8) Click 'Next' and check that only 'Prev' link is available,
           only one snapshot is visible (and it has correct name)
        9) Click 'Prev' and check result (should be the same as for step7)
        10) Click 'Prev' and check result (should be the same as for step6)
        11) Go to user settings page and restore 'Items Per Page'
        12) Delete created snapshots and volumes
        """
        volumes_page = self.home_pg.go_to_project_volumes_volumespage()
        count = 3
        items_per_page = 1
        snapshot_names = ["{0}_{1}".format(self.VOLUME_SNAPSHOT_NAME, i) for i
                          in range(count)]
        for i, name in enumerate(snapshot_names):
            volumes_snapshot_page = volumes_page.create_volume_snapshot(
                self.VOLUME_NAME, name)
            volumes_page.find_message_and_dismiss(messages.INFO)
            self.assertTrue(
                volumes_snapshot_page.is_volume_snapshot_available(name))
            if i < count - 1:
                self.home_pg.go_to_project_volumes_volumespage()

        first_page_definition = {'Next': True, 'Prev': False,
                                 'Count': items_per_page,
                                 'Names': [snapshot_names[2]]}
        second_page_definition = {'Next': True, 'Prev': True,
                                  'Count': items_per_page,
                                  'Names': [snapshot_names[1]]}
        third_page_definition = {'Next': False, 'Prev': True,
                                 'Count': items_per_page,
                                 'Names': [snapshot_names[0]]}

        settings_page = self.home_pg.go_to_settings_usersettingspage()
        settings_page.change_pagesize(items_per_page)
        settings_page.find_message_and_dismiss(messages.SUCCESS)

        volumes_snapshot_page = self.volumes_snapshot_page
        volumes_snapshot_page.volumesnapshots_table.assert_definition(
            first_page_definition)

        volumes_snapshot_page.volumesnapshots_table.turn_next_page()
        volumes_snapshot_page.volumesnapshots_table.assert_definition(
            second_page_definition)

        volumes_snapshot_page.volumesnapshots_table.turn_next_page()
        volumes_snapshot_page.volumesnapshots_table.assert_definition(
            third_page_definition)

        volumes_snapshot_page.volumesnapshots_table.turn_prev_page()
        volumes_snapshot_page.volumesnapshots_table.assert_definition(
            second_page_definition)

        volumes_snapshot_page.volumesnapshots_table.turn_prev_page()
        volumes_snapshot_page.volumesnapshots_table.assert_definition(
            first_page_definition)

        settings_page = self.home_pg.go_to_settings_usersettingspage()
        settings_page.change_pagesize()
        settings_page.find_message_and_dismiss(messages.SUCCESS)

        volumes_snapshot_page = self.volumes_snapshot_page
        volumes_snapshot_page.delete_volume_snapshots(snapshot_names)
        volumes_snapshot_page.find_message_and_dismiss(messages.SUCCESS)
        for name in snapshot_names:
            volumes_snapshot_page.is_volume_snapshot_deleted(name)
 def email(self):
     return helpers.gen_random_resource_name("email") + "@localhost"
Пример #38
0
class TestVolumesBasic(helpers.TestCase):
    """Login as demo user"""

    VOLUME_NAME = helpers.gen_random_resource_name("volume")

    @property
    def volumes_page(self):
        return self.home_pg.go_to_project_volumes_volumespage()

    def test_volume_create_edit_delete(self):
        """This test case checks create, edit, delete volume functionality:

        Steps:
        1. Login to Horizon Dashboard
        2. Navigate to Project -> Compute -> Volumes page
        3. Create new volume
        4. Check that the volume is in the list
        5. Check that no Error messages present
        6. Edit the volume
        7. Check that the volume is still in the list
        8. Check that no Error messages present
        9. Delete the volume via proper page (depends on user)
        10. Check that the volume is absent in the list
        11. Check that no Error messages present
        """
        volumes_page = self.home_pg.go_to_project_volumes_volumespage()
        volumes_page.create_volume(self.VOLUME_NAME)
        self.assertTrue(
            volumes_page.find_message_and_dismiss(messages.INFO))
        self.assertFalse(
            volumes_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(volumes_page.is_volume_present(self.VOLUME_NAME))
        self.assertTrue(volumes_page.is_volume_status(self.VOLUME_NAME,
                                                      'Available'))

        new_name = "edited_" + self.VOLUME_NAME
        volumes_page.edit_volume(self.VOLUME_NAME, new_name, "description")
        self.assertTrue(
            volumes_page.find_message_and_dismiss(messages.INFO))
        self.assertFalse(
            volumes_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(volumes_page.is_volume_present(new_name))
        self.assertTrue(volumes_page.is_volume_status(new_name, 'Available'))

        volumes_page = self.volumes_page
        volumes_page.delete_volume(new_name)
        self.assertTrue(
            volumes_page.find_message_and_dismiss(messages.INFO))
        self.assertFalse(
            volumes_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(volumes_page.is_volume_deleted(new_name))
        # NOTE(tsufiev): A short regression test on bug 1553314: we try to
        # re-open 'Create Volume' button after the volume was deleted. If the
        # regression occurs, the form won't appear (because link is going to be
        # invalid in this case). Give JavaScript callbacks an additional second
        # to do all the job and possibly cause the regression.
        if not isinstance(self, helpers.AdminTestCase):
            time.sleep(1)
            form = volumes_page.volumes_table.create_volume()
            form.cancel()

    def test_volumes_pagination(self):
        """This test checks volumes pagination

        Steps:
        1) Login to Horizon Dashboard
        2) Go to Project -> Volumes -> Volumes tab and create
        three volumes
        3) Navigate to user settings page
        4) Change 'Items Per Page' value to 1
        5) Go to Project -> Volumes -> Volumes tab or
        Admin -> Volume -> Volumes tab (depends on user)
        6) Check that only 'Next' link is available, only one volume is
        available (and it has correct name)
        7) Click 'Next' and check that both 'Prev' and 'Next' links are
        available, only one volume is available (and it has correct name)
        8) Click 'Next' and check that only 'Prev' link is available,
        only one volume is visible (and it has correct name)
        9) Click 'Prev' and check result (should be the same as for step7)
        10) Click 'Prev' and check result (should be the same as for step6)
        11) Go to user settings page and restore 'Items Per Page'
        12) Delete created volumes
        """
        volumes_page = self.home_pg.go_to_project_volumes_volumespage()
        count = 3
        items_per_page = 1
        volumes_names = ["{0}_{1}".format(self.VOLUME_NAME, i) for i in
                         range(count)]
        for volume_name in volumes_names:
            volumes_page.create_volume(volume_name)
            self.assertTrue(
                volumes_page.find_message_and_dismiss(messages.INFO))
            self.assertFalse(
                volumes_page.find_message_and_dismiss(messages.ERROR))
            self.assertTrue(volumes_page.is_volume_present(volume_name))
            self.assertTrue(volumes_page.is_volume_status(volume_name,
                                                          'Available'))

        first_page_definition = {'Next': True, 'Prev': False,
                                 'Count': items_per_page,
                                 'Names': [volumes_names[2]]}
        second_page_definition = {'Next': True, 'Prev': True,
                                  'Count': items_per_page,
                                  'Names': [volumes_names[1]]}
        third_page_definition = {'Next': False, 'Prev': True,
                                 'Count': items_per_page,
                                 'Names': [volumes_names[0]]}
        settings_page = self.home_pg.go_to_settings_usersettingspage()
        settings_page.change_pagesize(items_per_page)
        settings_page.find_message_and_dismiss(messages.SUCCESS)

        volumes_page = self.volumes_page
        volumes_page.volumes_table.assert_definition(first_page_definition)

        volumes_page.volumes_table.turn_next_page()
        volumes_page.volumes_table.assert_definition(second_page_definition)

        volumes_page.volumes_table.turn_next_page()
        volumes_page.volumes_table.assert_definition(third_page_definition)

        volumes_page.volumes_table.turn_prev_page()
        volumes_page.volumes_table.assert_definition(second_page_definition)

        volumes_page.volumes_table.turn_prev_page()
        volumes_page.volumes_table.assert_definition(first_page_definition)

        settings_page = self.home_pg.go_to_settings_usersettingspage()
        settings_page.change_pagesize()
        settings_page.find_message_and_dismiss(messages.SUCCESS)

        volumes_page = self.volumes_page
        volumes_page.delete_volumes(volumes_names)
        self.assertTrue(
            volumes_page.find_message_and_dismiss(messages.INFO))
        self.assertFalse(
            volumes_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(volumes_page.are_volumes_deleted(volumes_names))
Пример #39
0
 def group_name(self):
     return helpers.gen_random_resource_name("group")
 def __init__(self, *args, **kwgs):
     super(TestVolumes, self).__init__(*args, **kwgs)
     self.VOLUME_NAME = helpers.gen_random_resource_name("volume")
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

from openstack_dashboard.test.integration_tests import helpers
from openstack_dashboard.test.integration_tests.regions import messages

VOLUME_NAME = helpers.gen_random_resource_name("volume")
VOLUME_SNAPSHOT_NAME = helpers.gen_random_resource_name("volume_snapshot")


class TestVolumeSnapshots(helpers.TestCase):
    def setUp(self):
        """Setup for test_create_delete_volume_snapshot: create volume"""
        super(TestVolumeSnapshots, self).setUp()
        self.volumes_page = self.home_pg.go_to_compute_volumes_volumespage()
        self.volumes_page.create_volume(VOLUME_NAME)
        self.assertTrue(
            self.volumes_page.find_message_and_dismiss(messages.INFO))
        self.assertFalse(
            self.volumes_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(self.volumes_page.is_volume_status(VOLUME_NAME,
                                                           'Available'))
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

from openstack_dashboard.test.integration_tests import helpers
from openstack_dashboard.test.integration_tests.pages.project.data_processing\
    import jobbinariespage
from openstack_dashboard.test.integration_tests.tests import decorators


JOB_BINARY_INTERNAL = {
    # Size of binary name is limited to 50 characters
    jobbinariespage.JobbinariesPage.BINARY_NAME:
        helpers.gen_random_resource_name(resource='jobbinary',
                                         timestamp=False)[0:50],
    jobbinariespage.JobbinariesPage.BINARY_STORAGE_TYPE:
        "Internal database",
    jobbinariespage.JobbinariesPage.BINARY_URL: None,
    jobbinariespage.JobbinariesPage.INTERNAL_BINARY:
        "*Create a script",
    jobbinariespage.JobbinariesPage.BINARY_PATH: None,
    jobbinariespage.JobbinariesPage.SCRIPT_NAME:
        helpers.gen_random_resource_name(resource='scriptname',
                                         timestamp=False),
    jobbinariespage.JobbinariesPage.SCRIPT_TEXT: "test_script_text",
    jobbinariespage.JobbinariesPage.USERNAME: None,
    jobbinariespage.JobbinariesPage.PASSWORD: None,
    jobbinariespage.JobbinariesPage.DESCRIPTION: "test description"
}
 def username(self):
     return helpers.gen_random_resource_name("user")
Пример #44
0
class TestRouters(helpers.TestCase):
    ROUTER_NAME = helpers.gen_random_resource_name("router")

    @property
    def routers_page(self):
        return self.home_pg.go_to_project_network_routerspage()

    def _create_router(self):
        routers_page = self.routers_page

        routers_page.create_router(self.ROUTER_NAME)
        self.assertTrue(routers_page.find_message_and_dismiss(
            messages.SUCCESS))
        self.assertFalse(routers_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(routers_page.is_router_present(self.ROUTER_NAME))
        self.assertTrue(routers_page.is_router_active(self.ROUTER_NAME))

    def _delete_router(self):
        routers_page = self.routers_page
        routers_page.delete_router(self.ROUTER_NAME)
        self.assertTrue(routers_page.find_message_and_dismiss(
            messages.SUCCESS))
        self.assertFalse(routers_page.find_message_and_dismiss(messages.ERROR))
        self.assertFalse(routers_page.is_router_present(self.ROUTER_NAME))

    def test_router_create(self):
        """tests the router creation and deletion functionalities:

        * creates a new router for public network
        * verifies the router appears in the routers table as active
        * deletes the newly created router
        * verifies the router does not appear in the table after deletion
        """
        self._create_router()
        self._delete_router()

    def _create_interface(self, interfaces_page):
        interfaces_page.create_interface()
        interface_name = interfaces_page.interfaces_names[0]
        self.assertTrue(
            interfaces_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            interfaces_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(interfaces_page.is_interface_present(interface_name))
        self.assertTrue(
            interfaces_page.is_interface_status(interface_name, 'Down'))

    def _delete_interface(self, interfaces_page, interface_name):
        interfaces_page.delete_interface(interface_name)
        self.assertTrue(
            interfaces_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            interfaces_page.find_message_and_dismiss(messages.ERROR))
        self.assertFalse(interfaces_page.is_interface_present(interface_name))

    @decorators.skip_because(bugs=['1792028'])
    def test_router_add_delete_interface(self):
        """Tests the router interface creation and deletion functionalities:

        * Follows the steps to create a new router
        * Clicks on the new router name from the routers table
        * Moves to the Interfaces page/tab
        * Adds a new Interface for the first subnet id available
        * Verifies the new interface is in the routers table by checking that
          the interface is present in the table
        * Deletes the newly created interface
        * Verifies the interface is no longer in the interfaces table
        * Switches to the routers view by clicking on the breadcrumb link
        * Follows the steps to delete the router
        """
        self._create_router()

        routers_page = self.routers_page

        router_interfaces_page = routers_page. \
            go_to_interfaces_page(self.ROUTER_NAME)

        self._create_interface(router_interfaces_page)

        interface_name = router_interfaces_page.interfaces_names[0]

        self._delete_interface(router_interfaces_page, interface_name)

        router_interfaces_page.switch_to_routers_page()

        self._delete_router()

    @decorators.skip_because(bugs=['1792028'])
    def test_router_delete_interface_by_row(self):
        """Tests the router interface creation and deletion by row action:

        * Follows the steps to create a new router
        * Clicks on the new router name from the routers table
        * Moves to the Interfaces page/tab
        * Adds a new Interface for the first subnet id available
        * Verifies the new interface is in the routers table
        * Deletes the newly created interface by row action
        * Verifies the interface is no longer in the interfaces table
        * Switches to the routers view by clicking on the breadcrumb link
        * Follows the steps to delete the router
        """
        self._create_router()

        routers_page = self.routers_page

        router_interfaces_page = routers_page. \
            go_to_interfaces_page(self.ROUTER_NAME)

        self._create_interface(router_interfaces_page)

        interface_name = router_interfaces_page.interfaces_names[0]

        router_interfaces_page.delete_interface_by_row_action(interface_name)

        router_interfaces_page.switch_to_routers_page()

        self._delete_router()

    @decorators.skip_because(bugs=['1792028'])
    def test_router_overview_data(self):
        self._create_router()

        routers_page = self.routers_page

        router_overview_page = routers_page.\
            go_to_overview_page(self.ROUTER_NAME)

        self.assertTrue(
            router_overview_page.is_router_name_present(self.ROUTER_NAME))
        self.assertTrue(router_overview_page.is_router_status("Active"))

        network_overview_page = router_overview_page.go_to_router_network()

        # By default the router is created in the 'public' network so the line
        # below checks that such name is present in the network
        # details/overview page
        self.assertTrue(network_overview_page.is_network_name_present())
        self.assertTrue(network_overview_page.is_network_status("Active"))

        self._delete_router()
 def keypair_name(self):
     return helpers.gen_random_resource_name("keypair")
Пример #46
0
 def __init__(self, *args, **kwargs):
     super(TestImagesLegacy, self).__init__(*args, **kwargs)
     self.IMAGE_NAME = helpers.gen_random_resource_name("image")
Пример #47
0
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.
from openstack_dashboard.test.integration_tests import helpers
from openstack_dashboard.test.integration_tests.regions import messages


PROJECT_NAME = helpers.gen_random_resource_name("project")


class TestCreateDeleteProject(helpers.AdminTestCase):

    def setUp(self):
        super(TestCreateDeleteProject, self).setUp()
        self.projects_page = self.home_pg.go_to_identity_projectspage()

    def test_create_delete_project(self):
        self.projects_page.create_project(PROJECT_NAME)
        self.assertTrue(
            self.projects_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            self.projects_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(self.projects_page.is_project_present(PROJECT_NAME))
Пример #48
0
class TestVolumesActions(helpers.TestCase):
    VOLUME_NAME = helpers.gen_random_resource_name("volume")
    IMAGE_NAME = helpers.gen_random_resource_name("image")
    INSTANCE_NAME = helpers.gen_random_resource_name("instance")

    @property
    def volumes_page(self):
        return self.home_pg.go_to_project_volumes_volumespage()

    def setUp(self):
        super(TestVolumesActions, self).setUp()
        volumes_page = self.volumes_page
        volumes_page.create_volume(self.VOLUME_NAME)
        self.assertTrue(
            volumes_page.find_message_and_dismiss(messages.INFO))
        self.assertFalse(
            volumes_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(volumes_page.is_volume_present(self.VOLUME_NAME))
        self.assertTrue(
            volumes_page.is_volume_status(self.VOLUME_NAME, 'Available'))

        def cleanup():
            volumes_page = self.volumes_page
            volumes_page.delete_volume(self.VOLUME_NAME)
            self.assertTrue(
                volumes_page.find_message_and_dismiss(messages.INFO))
            self.assertFalse(
                volumes_page.find_message_and_dismiss(messages.ERROR))
            self.assertTrue(
                volumes_page.is_volume_deleted(self.VOLUME_NAME))

        self.addCleanup(cleanup)

    def test_volume_extend(self):
        """This test case checks extend volume functionality:

        Steps:
        1. Check current volume size
        2. Extend volume
        3. Check that no Error messages present
        4. Check that the volume is still in the list
        5. Check that the volume size is changed
        """
        volumes_page = self.volumes_page
        orig_size = volumes_page.get_size(self.VOLUME_NAME)
        volumes_page.extend_volume(self.VOLUME_NAME, orig_size + 1)
        self.assertTrue(
            volumes_page.find_message_and_dismiss(messages.INFO))
        self.assertFalse(
            volumes_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(
            volumes_page.is_volume_status(self.VOLUME_NAME, 'Available'))
        new_size = volumes_page.get_size(self.VOLUME_NAME)
        self.assertLess(orig_size, new_size)

    @pytest.mark.skip(reason="Bug 1847715")
    def test_volume_upload_to_image(self):
        """This test case checks upload volume to image functionality:

        Steps:
        1. Upload volume to image with some disk format
        2. Check that image is created
        3. Check that no Error messages present
        4. Delete the image
        5. Repeat actions for all disk formats
        """
        self.volumes_page = self.home_pg.go_to_project_volumes_volumespage()
        all_formats = {"qcow2": u'QCOW2', "raw": u'Raw', "vdi": u'VDI',
                       "vmdk": u'VMDK'}
        for disk_format in all_formats:
            self.volumes_page.upload_volume_to_image(self.VOLUME_NAME,
                                                     self.IMAGE_NAME,
                                                     disk_format)
            self.assertFalse(
                self.volumes_page.find_message_and_dismiss(messages.ERROR))
            self.assertTrue(self.volumes_page.is_volume_status(
                self.VOLUME_NAME, 'Available'))
            images_page = self.home_pg.go_to_project_compute_imagespage()
            self.assertTrue(images_page.is_image_present(self.IMAGE_NAME))
            self.assertTrue(images_page.is_image_active(self.IMAGE_NAME))
            self.assertEqual(images_page.get_image_format(self.IMAGE_NAME),
                             all_formats[disk_format])
            images_page.delete_image(self.IMAGE_NAME)
            self.assertTrue(images_page.find_message_and_dismiss(
                messages.INFO))
            self.assertFalse(images_page.find_message_and_dismiss(
                messages.ERROR))
            self.assertFalse(images_page.is_image_present(self.IMAGE_NAME))
            self.volumes_page = \
                self.home_pg.go_to_project_volumes_volumespage()

    @pytest.mark.skip(reason="Bug 1774697")
    def test_volume_launch_as_instance(self):
        """This test case checks launch volume as instance functionality:

        Steps:
        1. Launch volume as instance
        2. Check that instance is created
        3. Check that no Error messages present
        4. Check that instance status is 'active'
        5. Check that volume status is 'in use'
        6. Delete instance
        """
        self.volumes_page.launch_instance(self.VOLUME_NAME, self.INSTANCE_NAME)
        self.assertTrue(
            self.volumes_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            self.volumes_page.find_message_and_dismiss(messages.ERROR))
        instances_page = self.home_pg.go_to_project_compute_instancespage()
        self.assertTrue(instances_page.is_instance_active(self.INSTANCE_NAME))
        self.volumes_page = self.home_pg.go_to_project_volumes_volumespage()
        self.assertTrue(self.volumes_page.is_volume_status(self.VOLUME_NAME,
                                                           'In-use'))
        self.assertIn(self.INSTANCE_NAME,
                      self.volumes_page.get_attach_instance(self.VOLUME_NAME))
        instances_page = self.home_pg.go_to_project_compute_instancespage()
        instances_page.delete_instance(self.INSTANCE_NAME)
        self.assertTrue(
            instances_page.find_message_and_dismiss(messages.SUCCESS))
        self.assertFalse(
            instances_page.find_message_and_dismiss(messages.ERROR))
        self.assertTrue(instances_page.is_instance_deleted(self.INSTANCE_NAME))
        self.volumes_page = self.home_pg.go_to_project_volumes_volumespage()
Пример #49
0
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

from openstack_dashboard.test.integration_tests import helpers
from openstack_dashboard.test.integration_tests.regions import messages

IMAGE_NAME = helpers.gen_random_resource_name("image")


class TestImagesBasic(helpers.TestCase):

    @property
    def images_page(self):
        return self.home_pg.go_to_compute_imagespage()

    def test_image_create_delete(self):
        """tests the image creation and deletion functionalities:
        * creates a new image from horizon.conf http_image
        * verifies the image appears in the images table as active
        * deletes the newly created image
        * verifies the image does not appear in the table after deletion
        """