Replace 'raise AssertionError' in integration tests with 'self.assertIn'

Bug #1403268 reported by Imran Hayder
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Low
Masaki Matsushita

Bug Description

The integration test has a function called 'is_the_page_title' which checks the title of current page with title assigned for each page on horizon like Login page has its own title etc.
The comparison and raising of AssertionError when title doesnt meet actual page title , can be easily replaced with unittest built-in function 'assertIn( str1, str2, msg ) as follows:
 ORIGINAL:
    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))

PROPOSED :
    def is_the_current_page(self):
       self.assertIn(title, self.page_title,
            "Expected to find %s in page title, instead found: %s"
                % (self._page_title, self.page_title))

The source code for the specific function is here : https://git.openstack.org/cgit/openstack/horizon/tree/openstack_dashboard/test/integration_tests/pages/pageobject.py

description: updated
Liyingjun (liyingjun)
Changed in horizon:
status: New → Confirmed
assignee: nobody → Liyingjun (liyingjun)
Changed in horizon:
status: Confirmed → In Progress
status: In Progress → Confirmed
Changed in horizon:
assignee: Liyingjun (liyingjun) → Sanskar Jhanwar (sanskarjhanwar)
Arpit Agarwal (93arpit)
Changed in horizon:
assignee: Sanskar Jhanwar (sanskarjhanwar) → Arpit Agarwal (93arpit)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/165711

Changed in horizon:
assignee: Arpit Agarwal (93arpit) → Masaki Matsushita (glass-saga)
status: Confirmed → In Progress
David Lyle (david-lyle)
Changed in horizon:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/165711
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=e6f20dc03654bd6447ea9b9762dff6341c73eb4b
Submitter: Jenkins
Branch: master

commit e6f20dc03654bd6447ea9b9762dff6341c73eb4b
Author: Masaki Matsushita <email address hidden>
Date: Thu Mar 19 15:38:30 2015 +0900

    Replace 'raise AssertionError' with 'self.assertIn'

    Change-Id: I07a58b50ca5a9651103d2d16be6cf8bcc64beb3a
    Closes-Bug: #1403268

Changed in horizon:
status: In Progress → Fix Committed
Akihiro Motoki (amotoki)
Changed in horizon:
milestone: none → kilo-rc1
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: kilo-rc1 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.