Create base class for functional tests
Change-Id: I88fee89a1679cc17c06b1db28de5c3817b38308c
This commit is contained in:
parent
d9af9efaff
commit
d4360b90a5
31
openstack/tests/functional/base.py
Normal file
31
openstack/tests/functional/base.py
Normal file
@ -0,0 +1,31 @@
|
||||
# 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.
|
||||
|
||||
import unittest
|
||||
|
||||
import os_client_config
|
||||
|
||||
from openstack import connection
|
||||
from openstack import user_preference
|
||||
|
||||
|
||||
class BaseFunctionalTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
test_cloud = os_client_config.OpenStackConfig().get_one_cloud(
|
||||
'test_cloud')
|
||||
|
||||
pref = user_preference.UserPreference()
|
||||
pref.set_region(pref.ALL, test_cloud.region)
|
||||
|
||||
self.conn = connection.Connection(
|
||||
preference=pref,
|
||||
**test_cloud.config['auth'])
|
@ -10,29 +10,12 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import unittest
|
||||
|
||||
import os_client_config
|
||||
import six
|
||||
|
||||
from openstack import connection
|
||||
from openstack import user_preference
|
||||
from openstack.tests.functional import base
|
||||
|
||||
|
||||
class TestFlavor(unittest.TestCase):
|
||||
def setUp(self):
|
||||
test_cloud = os_client_config.OpenStackConfig().get_one_cloud(
|
||||
'test_cloud')
|
||||
|
||||
pref = user_preference.UserPreference()
|
||||
pref.set_region(pref.ALL, test_cloud.region)
|
||||
|
||||
self.conn = connection.Connection(
|
||||
preference=pref,
|
||||
auth_url=test_cloud.config['auth']['auth_url'],
|
||||
project_name=test_cloud.config['auth']['project_name'],
|
||||
username=test_cloud.config['auth']['username'],
|
||||
password=test_cloud.config['auth']['password'])
|
||||
class TestFlavor(base.BaseFunctionalTest):
|
||||
|
||||
def test_flavors(self):
|
||||
flavors = list(self.conn.compute.list_flavors())
|
||||
|
@ -10,31 +10,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import unittest
|
||||
|
||||
import os_client_config
|
||||
|
||||
from openstack import connection
|
||||
from openstack import user_preference
|
||||
from openstack.tests.functional import base
|
||||
|
||||
|
||||
class TestStack(unittest.TestCase):
|
||||
def setUp(self):
|
||||
test_cloud = os_client_config.OpenStackConfig().get_one_cloud(
|
||||
'test_cloud')
|
||||
|
||||
pref = user_preference.UserPreference()
|
||||
pref.set_region(pref.ALL, test_cloud.region)
|
||||
|
||||
self.conn = connection.Connection(
|
||||
preference=pref,
|
||||
auth_url=test_cloud.config['auth']['auth_url'],
|
||||
project_name=test_cloud.config['auth']['project_name'],
|
||||
username=test_cloud.config['auth']['username'],
|
||||
password=test_cloud.config['auth']['password'])
|
||||
|
||||
if self.conn.compute.find_keypair('heat_key') is None:
|
||||
self.conn.compute.create_keypair(name='heat_key')
|
||||
class TestStack(base.BaseFunctionalTest):
|
||||
|
||||
def test_create_stack(self):
|
||||
stack = self.conn.orchestration.create_stack(
|
||||
|
Loading…
x
Reference in New Issue
Block a user