Invalid status code assertion after handle expected exception

Bug #1179350 reported by Alex Xu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Alex Xu

Bug Description

def test_create_two_subnets_same_cidr_returns_400(self):
        gateway_ip_1 = '10.0.0.1'
        cidr_1 = '10.0.0.0/24'
        gateway_ip_2 = '10.0.0.10'
        cidr_2 = '10.0.0.0/24'
        with self.network() as network:
            with self.subnet(network=network,
                             gateway_ip=gateway_ip_1,
                             cidr=cidr_1):
                with testtools.ExpectedException(
                        webob.exc.HTTPClientError) as ctx_manager:
                    with self.subnet(network=network,
                                     gateway_ip=gateway_ip_2,
                                     cidr=cidr_2):
                        pass
                    <! ---------------- Because self.subnet raise the exception, then will exit the with block, so code never can reach at here' ---------------->
                    self.assertEqual(ctx_manager.exception.code, 400)

There are many test-case like this using 'testtools.ExpectedException' and with invalid status code assertion.

Tags: unittest
Alex Xu (xuhj)
Changed in quantum:
assignee: nobody → Alex Xu (xuhj)
summary: - Invalid status code assertion after handle excected exception
+ Invalid status code assertion after handle expected exception
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to quantum (master)

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

Changed in quantum:
status: New → In Progress
Alex Xu (xuhj)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to quantum (master)

Reviewed: https://review.openstack.org/28918
Committed: http://github.com/openstack/quantum/commit/4184d30458a2eae46c2ec4db6fca26e57a8a2353
Submitter: Jenkins
Branch: master

commit 4184d30458a2eae46c2ec4db6fca26e57a8a2353
Author: He Jie Xu <email address hidden>
Date: Mon May 13 10:26:09 2013 +0800

    Fix invalid status code assertion after handle expected exception

    Fix bug 1179350

    Change-Id: I88b511206d97f2ad607a7889c61df69a8638ced3

Changed in quantum:
status: In Progress → Fix Committed
Changed in quantum:
importance: Undecided → Medium
milestone: none → havana-1
tags: added: grizzly-backport-potential unittest
Thierry Carrez (ttx)
Changed in quantum:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: havana-1 → 2013.2
Alan Pevec (apevec)
tags: removed: grizzly-backport-potential
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.