Change in vdsm[master]: imagetickets: add tests

nsoffer at redhat.com nsoffer at redhat.com
Mon Feb 29 22:14:57 UTC 2016


Nir Soffer has posted comments on this change.

Change subject: imagetickets: add tests
......................................................................


Patch Set 10:

(2 comments)

https://gerrit.ovirt.org/#/c/52900/10/tests/imagetickets_test.py
File tests/imagetickets_test.py:

Line 121: 
Line 122:     @MonkeyPatch(imagetickets, 'uhttp', FakeUHTTP())
Line 123:     def test_res_header_error(self):
Line 124:         imagetickets.uhttp.response = \
Line 125:             FakeResponse(status=300, headers={"content-length": "invalid"})
Please avoid \ - use this format:

    imagetickets.uhttp.response = FakeResponse(
        status=300, headers={"content-length": "invalid"})

Same for other tests using this pattern.
Line 126:         with self.assertRaises(se.ImageDaemonError):
Line 127:             imagetickets.remove_ticket("uuid")
Line 128: 
Line 129:     @MonkeyPatch(imagetickets, 'uhttp', FakeUHTTP())


Line 136:     @MonkeyPatch(imagetickets, 'uhttp', FakeUHTTP())
Line 137:     def test_image_daemon_error_ret(self):
Line 138:         imagetickets.uhttp.response = \
Line 139:             FakeResponse(status=300,
Line 140:                          data=u'{"image_daemon_message":' u'"content"}')
This should be one string - it works because Python joins multiple strings, like C, but it is confusing.

    u'{"image_daemon_message":"content"}'
Line 141:         try:
Line 142:             imagetickets.remove_ticket("uuid")
Line 143:         except se.ImageDaemonError as e:
Line 144:             self.assertTrue("image_daemon_message=content" in e.value)


-- 
To view, visit https://gerrit.ovirt.org/52900
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I2728851a91529ec35501f423d9a798af961fb82a
Gerrit-PatchSet: 10
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Amit Aviram <aaviram at redhat.com>
Gerrit-Reviewer: Amit Aviram <aaviram at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Liron Aravot <laravot at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list