summaryrefslogtreecommitdiff
path: root/openstack_dashboard/test/integration_tests/tests/test_host_aggregates.py
blob: 4fc6b686eb728e3be25fe43fbc9336e3d294dd3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#    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


class TestHostAggregates(helpers.AdminTestCase):
    HOST_AGGREGATE_NAME = helpers.gen_random_resource_name("host_aggregate")
    HOST_AGGREGATE_AVAILABILITY_ZONE = "nova"

    def test_host_aggregate_create(self):
        """tests the host aggregate creation and deletion functionalities:

        * creates a new host aggregate
        * verifies the host aggregate appears in the host aggregates table
        * deletes the newly created host aggregate
        * verifies the host aggregate does not appear in the table
        * after deletion
        """

        hostaggregates_page = \
            self.home_pg.go_to_admin_compute_hostaggregatespage()

        hostaggregates_page.create_host_aggregate(
            name=self.HOST_AGGREGATE_NAME,
            availability_zone=self.HOST_AGGREGATE_AVAILABILITY_ZONE)
        self.assertEqual(
            hostaggregates_page.find_messages_and_dismiss(), {messages.SUCCESS})
        self.assertTrue(hostaggregates_page.is_host_aggregate_present(
            self.HOST_AGGREGATE_NAME))

        hostaggregates_page.delete_host_aggregate(self.HOST_AGGREGATE_NAME)
        self.assertEqual(
            hostaggregates_page.find_messages_and_dismiss(), {messages.SUCCESS})
        self.assertFalse(hostaggregates_page.is_host_aggregate_present(
            self.HOST_AGGREGATE_NAME))