"Fossies" - the Fresh Open Source Software Archive

Member "horizon-14.0.4/openstack_dashboard/test/integration_tests/tests/test_floatingips.py" (22 Oct 2019, 4652 Bytes) of package /linux/misc/openstack/horizon-14.0.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # Copyright 2015 Hewlett-Packard Development Company, L.P
    2 # All Rights Reserved.
    3 #
    4 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
    5 #    not use this file except in compliance with the License. You may obtain
    6 #    a copy of the License at
    7 #
    8 #         http://www.apache.org/licenses/LICENSE-2.0
    9 #
   10 #    Unless required by applicable law or agreed to in writing, software
   11 #    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   12 #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   13 #    License for the specific language governing permissions and limitations
   14 #    under the License.
   15 
   16 from openstack_dashboard.test.integration_tests import decorators
   17 from openstack_dashboard.test.integration_tests import helpers
   18 from openstack_dashboard.test.integration_tests.regions import messages
   19 
   20 
   21 class TestFloatingip(helpers.TestCase):
   22     """Checks that the user is able to allocate/release floatingip."""
   23 
   24     def test_floatingip(self):
   25         floatingip_page = \
   26             self.home_pg.go_to_project_network_floatingipspage()
   27         floating_ip = floatingip_page.allocate_floatingip()
   28         self.assertTrue(
   29             floatingip_page.find_message_and_dismiss(messages.SUCCESS))
   30         self.assertFalse(
   31             floatingip_page.find_message_and_dismiss(messages.ERROR))
   32         self.assertTrue(floatingip_page.is_floatingip_present(floating_ip))
   33 
   34         floatingip_page.release_floatingip(floating_ip)
   35         self.assertTrue(
   36             floatingip_page.find_message_and_dismiss(messages.SUCCESS))
   37         self.assertFalse(
   38             floatingip_page.find_message_and_dismiss(messages.ERROR))
   39         self.assertFalse(floatingip_page.is_floatingip_present(floating_ip))
   40 
   41 
   42 class TestFloatingipAssociateDisassociate(helpers.TestCase):
   43     """Checks that the user is able to Associate/Disassociate floatingip."""
   44 
   45     @decorators.skip_because(bugs=['1774697'])
   46     def test_floatingip_associate_disassociate(self):
   47         instance_name = helpers.gen_random_resource_name('instance',
   48                                                          timestamp=False)
   49         instances_page = self.home_pg.go_to_project_compute_instancespage()
   50         instances_page.create_instance(instance_name)
   51         self.assertTrue(
   52             instances_page.find_message_and_dismiss(messages.SUCCESS))
   53         self.assertFalse(
   54             instances_page.find_message_and_dismiss(messages.ERROR))
   55         self.assertTrue(instances_page.is_instance_active(instance_name))
   56         instance_ipv4 = instances_page.get_fixed_ipv4(instance_name)
   57         instance_info = "{} {}".format(instance_name, instance_ipv4)
   58 
   59         floatingip_page = \
   60             self.home_pg.go_to_project_network_floatingipspage()
   61         floating_ip = floatingip_page.allocate_floatingip()
   62         self.assertTrue(
   63             floatingip_page.find_message_and_dismiss(messages.SUCCESS))
   64         self.assertFalse(
   65             floatingip_page.find_message_and_dismiss(messages.ERROR))
   66         self.assertTrue(floatingip_page.is_floatingip_present(floating_ip))
   67 
   68         self.assertEqual('-', floatingip_page.get_fixed_ip(floating_ip))
   69         floatingip_page.associate_floatingip(floating_ip, instance_name,
   70                                              instance_ipv4)
   71         self.assertTrue(
   72             floatingip_page.find_message_and_dismiss(messages.SUCCESS))
   73         self.assertFalse(
   74             floatingip_page.find_message_and_dismiss(messages.ERROR))
   75         self.assertEqual(instance_info,
   76                          floatingip_page.get_fixed_ip(floating_ip))
   77 
   78         floatingip_page.disassociate_floatingip(floating_ip)
   79         self.assertTrue(
   80             floatingip_page.find_message_and_dismiss(messages.SUCCESS))
   81         self.assertFalse(
   82             floatingip_page.find_message_and_dismiss(messages.ERROR))
   83         self.assertEqual('-', floatingip_page.get_fixed_ip(floating_ip))
   84 
   85         floatingip_page.release_floatingip(floating_ip)
   86         self.assertTrue(
   87             floatingip_page.find_message_and_dismiss(messages.SUCCESS))
   88         self.assertFalse(
   89             floatingip_page.find_message_and_dismiss(messages.ERROR))
   90         self.assertFalse(floatingip_page.is_floatingip_present(floating_ip))
   91 
   92         instances_page = self.home_pg.go_to_project_compute_instancespage()
   93         instances_page.delete_instance(instance_name)
   94         self.assertTrue(
   95             instances_page.find_message_and_dismiss(messages.SUCCESS))
   96         self.assertFalse(
   97             instances_page.find_message_and_dismiss(messages.ERROR))
   98         self.assertTrue(instances_page.is_instance_deleted(instance_name))