From e6f20dc03654bd6447ea9b9762dff6341c73eb4b Mon Sep 17 00:00:00 2001 From: Masaki Matsushita Date: Thu, 19 Mar 2015 15:38:30 +0900 Subject: [PATCH] Replace 'raise AssertionError' with 'self.assertIn' Change-Id: I07a58b50ca5a9651103d2d16be6cf8bcc64beb3a Closes-Bug: #1403268 --- .../test/integration_tests/basewebobject.py | 3 ++- .../test/integration_tests/pages/pageobject.py | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openstack_dashboard/test/integration_tests/basewebobject.py b/openstack_dashboard/test/integration_tests/basewebobject.py index 400285d2d2..cc95c1b0e1 100644 --- a/openstack_dashboard/test/integration_tests/basewebobject.py +++ b/openstack_dashboard/test/integration_tests/basewebobject.py @@ -12,9 +12,10 @@ import selenium.common.exceptions as Exceptions import selenium.webdriver.support.ui as Support from selenium.webdriver.support import wait +import unittest -class BaseWebObject(object): +class BaseWebObject(unittest.TestCase): """Base class for all web objects.""" def __init__(self, driver, conf): self.driver = driver diff --git a/openstack_dashboard/test/integration_tests/pages/pageobject.py b/openstack_dashboard/test/integration_tests/pages/pageobject.py index 6222409cc6..7a66fd33f4 100644 --- a/openstack_dashboard/test/integration_tests/pages/pageobject.py +++ b/openstack_dashboard/test/integration_tests/pages/pageobject.py @@ -27,10 +27,9 @@ class PageObject(basewebobject.BaseWebObject): return self.driver.title def is_the_current_page(self): - if self._page_title not in self.page_title: - raise AssertionError( - "Expected to find %s in page title, instead found: %s" - % (self._page_title, self.page_title)) + self.assertIn(self._page_title, self.page_title, + "Expected to find %s in page title, instead found: %s" + % (self._page_title, self.page_title)) return True def get_url_current_page(self):