Ensure that integration tests are being run in proper project
Admin users run tests in an admin project, regular users run them in a demo project. That should prevent situations when tests don't have an access to a resources created in a project different from the current one. Closes-Bug: #1542211 Change-Id: I497648ce5126e187744b5795bd524b7aba22c7a6
This commit is contained in:
parent
78cbb5eec2
commit
0419b0e2e6
@ -32,6 +32,10 @@ IdentityGroup = [
|
|||||||
default='secretadmin',
|
default='secretadmin',
|
||||||
help="API key to use when authenticating.",
|
help="API key to use when authenticating.",
|
||||||
secret=True),
|
secret=True),
|
||||||
|
cfg.StrOpt('home_project',
|
||||||
|
default='demo',
|
||||||
|
help="Project to keep all objects belonging to a regular user."
|
||||||
|
),
|
||||||
cfg.StrOpt('admin_username',
|
cfg.StrOpt('admin_username',
|
||||||
default='admin',
|
default='admin',
|
||||||
help="Administrative Username to use for admin API "
|
help="Administrative Username to use for admin API "
|
||||||
@ -40,6 +44,9 @@ IdentityGroup = [
|
|||||||
default='secretadmin',
|
default='secretadmin',
|
||||||
help="API key to use when authenticating as admin.",
|
help="API key to use when authenticating as admin.",
|
||||||
secret=True),
|
secret=True),
|
||||||
|
cfg.StrOpt('admin_home_project',
|
||||||
|
default='admin',
|
||||||
|
help="Project to keep all objects belonging to an admin user."),
|
||||||
]
|
]
|
||||||
|
|
||||||
ImageGroup = [
|
ImageGroup = [
|
||||||
|
@ -26,6 +26,7 @@ import xvfbwrapper
|
|||||||
from horizon.test import webdriver
|
from horizon.test import webdriver
|
||||||
from openstack_dashboard.test.integration_tests import config
|
from openstack_dashboard.test.integration_tests import config
|
||||||
from openstack_dashboard.test.integration_tests.pages import loginpage
|
from openstack_dashboard.test.integration_tests.pages import loginpage
|
||||||
|
from openstack_dashboard.test.integration_tests.regions import messages
|
||||||
|
|
||||||
ROOT_PATH = os.path.dirname(os.path.abspath(config.__file__))
|
ROOT_PATH = os.path.dirname(os.path.abspath(config.__file__))
|
||||||
|
|
||||||
@ -181,6 +182,7 @@ class TestCase(BaseTestCase):
|
|||||||
|
|
||||||
TEST_USER_NAME = BaseTestCase.CONFIG.identity.username
|
TEST_USER_NAME = BaseTestCase.CONFIG.identity.username
|
||||||
TEST_PASSWORD = BaseTestCase.CONFIG.identity.password
|
TEST_PASSWORD = BaseTestCase.CONFIG.identity.password
|
||||||
|
HOME_PROJECT = BaseTestCase.CONFIG.identity.home_project
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestCase, self).setUp()
|
super(TestCase, self).setUp()
|
||||||
@ -189,6 +191,11 @@ class TestCase(BaseTestCase):
|
|||||||
self.zoom_out()
|
self.zoom_out()
|
||||||
self.home_pg = self.login_pg.login(self.TEST_USER_NAME,
|
self.home_pg = self.login_pg.login(self.TEST_USER_NAME,
|
||||||
self.TEST_PASSWORD)
|
self.TEST_PASSWORD)
|
||||||
|
self.home_pg.change_project(self.HOME_PROJECT)
|
||||||
|
self.assertTrue(
|
||||||
|
self.home_pg.find_message_and_dismiss(messages.SUCCESS))
|
||||||
|
self.assertFalse(
|
||||||
|
self.home_pg.find_message_and_dismiss(messages.ERROR))
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
try:
|
try:
|
||||||
@ -203,3 +210,4 @@ class AdminTestCase(TestCase):
|
|||||||
|
|
||||||
TEST_USER_NAME = TestCase.CONFIG.identity.admin_username
|
TEST_USER_NAME = TestCase.CONFIG.identity.admin_username
|
||||||
TEST_PASSWORD = TestCase.CONFIG.identity.admin_password
|
TEST_PASSWORD = TestCase.CONFIG.identity.admin_password
|
||||||
|
HOME_PROJECT = BaseTestCase.CONFIG.identity.admin_home_project
|
||||||
|
@ -43,6 +43,9 @@ username=demo
|
|||||||
# API key to use when authenticating. (string value)
|
# API key to use when authenticating. (string value)
|
||||||
password=secretadmin
|
password=secretadmin
|
||||||
|
|
||||||
|
# Project in which a regular user creates everything by default
|
||||||
|
home_project=demo
|
||||||
|
|
||||||
# Administrative Username to use for admin API requests.
|
# Administrative Username to use for admin API requests.
|
||||||
# (string value)
|
# (string value)
|
||||||
admin_username=admin
|
admin_username=admin
|
||||||
@ -50,6 +53,9 @@ admin_username=admin
|
|||||||
# API key to use when authenticating as admin. (string value)
|
# API key to use when authenticating as admin. (string value)
|
||||||
admin_password=secretadmin
|
admin_password=secretadmin
|
||||||
|
|
||||||
|
# Project in which an admin user creates everything by default
|
||||||
|
admin_home_project=admin
|
||||||
|
|
||||||
[network]
|
[network]
|
||||||
# The cidr block to allocate tenant ipv4 subnets from (string value)
|
# The cidr block to allocate tenant ipv4 subnets from (string value)
|
||||||
tenant_network_cidr=10.100.0.0/16
|
tenant_network_cidr=10.100.0.0/16
|
||||||
|
@ -21,8 +21,9 @@ class TopBarRegion(baseregion.BaseRegion):
|
|||||||
'.nav.navbar-nav.navbar-right li.dropdown')
|
'.nav.navbar-nav.navbar-right li.dropdown')
|
||||||
_openstack_brand_locator = (by.By.CSS_SELECTOR, 'a[href*="/home/"]')
|
_openstack_brand_locator = (by.By.CSS_SELECTOR, 'a[href*="/home/"]')
|
||||||
|
|
||||||
_user_dropdown_project_locator = (by.By.CSS_SELECTOR,
|
_user_dropdown_project_locator = (
|
||||||
'li.dropdown.context-selection')
|
by.By.CSS_SELECTOR,
|
||||||
|
'.navbar-collapse > ul.navbar-nav:first-child li.dropdown')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def user(self):
|
def user(self):
|
||||||
|
@ -248,8 +248,8 @@ class TabbedMenuRegion(baseregion.BaseRegion):
|
|||||||
class ProjectDropDownRegion(DropDownMenuRegion):
|
class ProjectDropDownRegion(DropDownMenuRegion):
|
||||||
|
|
||||||
_menu_first_child_locator = (by.By.CSS_SELECTOR, '*')
|
_menu_first_child_locator = (by.By.CSS_SELECTOR, '*')
|
||||||
_menu_items_locator = (by.By.CSS_SELECTOR,
|
_menu_items_locator = (
|
||||||
'div.context-lists a')
|
by.By.CSS_SELECTOR, 'ul.context-selection li > a')
|
||||||
|
|
||||||
def click_on_project(self, name):
|
def click_on_project(self, name):
|
||||||
for item in self.menu_items:
|
for item in self.menu_items:
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
from openstack_dashboard.test.integration_tests import decorators
|
|
||||||
from openstack_dashboard.test.integration_tests import helpers
|
from openstack_dashboard.test.integration_tests import helpers
|
||||||
from openstack_dashboard.test.integration_tests.regions import messages
|
from openstack_dashboard.test.integration_tests.regions import messages
|
||||||
|
|
||||||
@ -17,7 +16,6 @@ INSTANCES_NAME = helpers.gen_random_resource_name('instance',
|
|||||||
timestamp=False)
|
timestamp=False)
|
||||||
|
|
||||||
|
|
||||||
@decorators.skip_because(bugs=["1542211"])
|
|
||||||
class TestInstances(helpers.AdminTestCase):
|
class TestInstances(helpers.AdminTestCase):
|
||||||
"""This is a basic scenario to test:
|
"""This is a basic scenario to test:
|
||||||
* Create Instance and Delete Instance
|
* Create Instance and Delete Instance
|
||||||
|
Loading…
Reference in New Issue
Block a user