keystoneclient inconsistently mocks httplib2 content-type/body handling

Bug #1050091 reported by Dolph Mathews
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-keystoneclient
Fix Released
Medium
Joseph Heck

Bug Description

Keystone client tests extensively mock httplib2.Http.request, however I found several unrealistic / inconsistent patterns in those unit tests:

- Some status codes for empty response bodies are mocked as 200's instead of 204's
- Some "empty" response bodies are mocked as empty JSON objects, instead of simply empty bodies
- Some response bodies are asserted to be the python null value (None), which I don't think httplib2 would ever return
- Valid "Content-Type: application/json" headers are sometimes mocked along with what should be empty request bodies (and therefore invalid as JSON)

Joseph Heck (heckj)
no longer affects: keystone
Changed in python-keystoneclient:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-keystoneclient (master)

Reviewed: https://review.openstack.org/12909
Committed: http://github.com/openstack/python-keystoneclient/commit/59917278d7a2e3760d6229f874b2a953bf2b28cc
Submitter: Jenkins
Branch: master

commit 59917278d7a2e3760d6229f874b2a953bf2b28cc
Author: Dolph Mathews <email address hidden>
Date: Wed Sep 12 17:34:09 2012 -0500

    Fixed httplib2 mocking (bug 1050091, bug 1050097)

    - 204 No Content should be mocked with empty response bodies
    - Content-Type headers should not be mocked with empty response bodies
    - httplib2 would never return None as a response body
    - The Identity API never expects a req/resp body with a string value of "null"

    Change-Id: Ie22e8e5288573268165ed06049978195955f8ca6

Changed in python-keystoneclient:
status: Triaged → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-keystoneclient (feature/keystone-v3)

Reviewed: https://review.openstack.org/12943
Committed: http://github.com/openstack/python-keystoneclient/commit/0ee514703094e3410d71b0078bd3d27db4d790dc
Submitter: Jenkins
Branch: feature/keystone-v3

commit 0ee514703094e3410d71b0078bd3d27db4d790dc
Author: Dolph Mathews <email address hidden>
Date: Wed Sep 12 17:34:09 2012 -0500

    Fixed httplib2 mocking (bug 1050091, bug 1050097)

    - 204 No Content should be mocked with empty response bodies
    - Content-Type headers should not be mocked with empty response bodies
    - httplib2 would never return None as a response body
    - The Identity API never expects a req/resp body with a string value of "null"

    Change-Id: Ie22e8e5288573268165ed06049978195955f8ca6

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-keystoneclient (master)

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

Changed in python-keystoneclient:
assignee: nobody → Dolph Mathews (dolph)
status: Fix Committed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Changed in python-keystoneclient:
assignee: Dolph Mathews (dolph) → Joseph Heck (heckj)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-keystoneclient (master)
Download full text (4.5 KiB)

Reviewed: https://review.openstack.org/15066
Committed: http://github.com/openstack/python-keystoneclient/commit/1b7eca834977df970faabacde85c31f62619034b
Submitter: Jenkins
Branch: master

commit 62c55bc2f0f13630db6d9962ae0edf468f495276
Author: Dolph Mathews <email address hidden>
Date: Wed Oct 10 07:38:27 2012 +0000

    Enable/disable services/endpoints (bug 1048662)

    Change-Id: I664b7f7dfa281a4481bfc37eab0948a901f1c0c5

commit 46360085ebcbea61a04ab001e7d9597d0ed0b746
Author: Dolph Mathews <email address hidden>
Date: Thu Sep 13 07:55:26 2012 -0500

    v3 Domain/Project role grants

    Change-Id: Idbe0702b42603d6f9f133c9f1855ea9b4f222066

commit 0ee514703094e3410d71b0078bd3d27db4d790dc
Author: Dolph Mathews <email address hidden>
Date: Wed Sep 12 17:34:09 2012 -0500

    Fixed httplib2 mocking (bug 1050091, bug 1050097)

    - 204 No Content should be mocked with empty response bodies
    - Content-Type headers should not be mocked with empty response bodies
    - httplib2 would never return None as a response body
    - The Identity API never expects a req/resp body with a string value of "null"

    Change-Id: Ie22e8e5288573268165ed06049978195955f8ca6

commit dd84cdc340c782f53c79ede7ec1e196828605f96
Author: Dolph Mathews <email address hidden>
Date: Tue Sep 11 15:43:47 2012 -0500

    v3 List projects for a user

    Change-Id: I4d3dfebb0bbe3799c05b9bc39fe2454ccf300873

commit 6c84d7bf8567bfa3024cd38f80c01ed84768a89c
Author: Dolph Mathews <email address hidden>
Date: Tue Sep 11 15:42:38 2012 -0500

    v3 Credential CRUD

    Change-Id: I646ff7db3ccf827f912ebdb78fdf8d765d52c26c

commit 298b1c4903a87b2063772b66150af1fa344a95d4
Author: Dolph Mathews <email address hidden>
Date: Tue Sep 11 15:40:37 2012 -0500

    v3 User CRUD

    Change-Id: Ieea3c474ce3795e2c97e399988228cdb2715f2ef

commit 577c78c9919478305154919e4011cc55469d7815
Author: Dolph Mathews <email address hidden>
Date: Tue Sep 11 15:38:22 2012 -0500

    v3 Project CRUD

    Change-Id: I027dbba3a0573fde590295be5b31e3701d8c01f5

commit f885c0d09a6464e0d94d1c295a605877d711f88a
Author: Dolph Mathews <email address hidden>
Date: Tue Sep 11 15:34:56 2012 -0500

    v3 Role CRUD

    Change-Id: Iacb6e56ef60537b7cd3a4fbe3db1f0db1604fdc2

commit ac3beb3671cdccf9a5285e8b2296e950b1a8be9b
Author: Dolph Mathews <email address hidden>
Date: Tue Sep 11 12:32:01 2012 -0500

    v3 Domain CRUD

    Change-Id: I830055dc3bd079715403029a85890c40b687f632

commit 0534c02351c225412354215a1653aa755d92a6e5
Author: Dolph Mathews <email address hidden>
Date: Tue Sep 11 11:44:05 2012 -0500

    v3 Policy CRUD

    Change-Id: Iaecf3427877dd1751bb546c24413bc759938922c

commit 2af709ceb6cf20f37f79baed1d93a14874b49a5b
Author: Dolph Mathews <email address hidden>
Date: Tue Sep 11 11:40:25 2012 -0500

    v3 Endpoint CRUD

    Change-Id: Iff60668a80f8a6679a691a8f256652d7814f2785

commit a0ff56fea0b7dfcb21fdd5e0f81c5e937f8c2324
Author: Dolph Mathews <email address hidden>
Date: Tue Sep 11 11:22:30 2012 -0500

    v3 Service CRUD

    Change-Id: I5594ce92e99241f95775773233f09170a8a371b1

commi...

Read more...

Changed in python-keystoneclient:
status: In Progress → Fix Committed
Dolph Mathews (dolph)
Changed in python-keystoneclient:
milestone: none → 0.2.0
status: Fix Committed → Fix Released
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.