Merge "Modified teardown method to handle login and logout failure."

This commit is contained in:
Jenkins 2015-01-28 17:32:27 +00:00 committed by Gerrit Code Review
commit effcb1cf9c
1 changed files with 12 additions and 6 deletions

View File

@ -46,7 +46,7 @@ class BaseTestCase(testtools.TestCase):
def tearDown(self):
if os.environ.get('INTEGRATION_TESTS', False):
self.driver.close()
self.driver.quit()
if hasattr(self, 'vdisplay'):
self.vdisplay.stop()
super(BaseTestCase, self).tearDown()
@ -61,9 +61,12 @@ class TestCase(BaseTestCase):
self.home_pg = self.login_pg.login()
def tearDown(self):
self.home_pg.go_to_home_page()
self.home_pg.log_out()
super(TestCase, self).tearDown()
try:
if self.home_pg.is_logged_in:
self.home_pg.go_to_home_page()
self.home_pg.log_out()
finally:
super(TestCase, self).tearDown()
class AdminTestCase(BaseTestCase):
@ -76,5 +79,8 @@ class AdminTestCase(BaseTestCase):
password=self.conf.identity.admin_password)
def tearDown(self):
self.home_pg.log_out()
super(AdminTestCase, self).tearDown()
try:
if self.home_pg.is_logged_in:
self.home_pg.log_out()
finally:
super(AdminTestCase, self).tearDown()