)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":1921,"name":"Andrea Frittoli","email":"andrea.frittoli@gmail.com","username":"andrea-frittoli"},"change_message_id":"8cefa948d3ad4c6a55c86cebca90d7bf54f839e4","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     donald-ngo \u003cdonald.ngo@hp.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2013-02-08 15:53:36 -0800"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Fix for bug/1119825: Add negative tests for creating server with notexistent security group"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Change-Id: I8fdc80567ab3985b8a15a9f8632700400be7cd9e"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"AAAAM3%2F%2FCDQ%3D","line":7,"updated":"2013-02-10 21:02:30.000000000","message":"pep8 fails because title is too long.","commit_id":"2b0997b7a32d17afb67047022921150934c99c4a"},{"author":{"_account_id":1794,"name":"Donald Ngo","email":"donald.ngo@hp.com","username":"donald-ngo"},"change_message_id":"3d4336d069683111df665ff8c5339d996c079df7","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     donald-ngo \u003cdonald.ngo@hp.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2013-02-08 15:53:36 -0800"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Fix for bug/1119825: Add negative tests for creating server with notexistent security group"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Change-Id: I8fdc80567ab3985b8a15a9f8632700400be7cd9e"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"AAAAM3%2F%2FALo%3D","line":7,"in_reply_to":"AAAAM3%2F%2FCDQ%3D","updated":"2013-02-11 22:15:23.000000000","message":"Thanks I\u0027m going to change it.","commit_id":"2b0997b7a32d17afb67047022921150934c99c4a"}],"tempest/tests/compute/servers/test_servers_negative.py":[{"author":{"_account_id":5292,"name":"Christopher Yeoh","email":"cbkyeoh@gmail.com","username":"cyeoh-0"},"change_message_id":"d8e551251aad7d641c61937de125bf9d141632b1","unresolved":false,"context_lines":[{"line_number":288,"context_line":"        except exceptions.BadRequest:"},{"line_number":289,"context_line":"            pass"},{"line_number":290,"context_line":"        else:"},{"line_number":291,"context_line":"            self.fail(\u0027Server was created with nonexistent security group\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAM3%2F%2FDME%3D","line":291,"updated":"2013-02-09 00:06:00.000000000","message":"We seem to have two ways of writing a test that expects an exception. Either like this or with assertRaises (which seems to be the most common way). I wonder for consistency and easy of reading tests we should settle on one style?","commit_id":"2b0997b7a32d17afb67047022921150934c99c4a"},{"author":{"_account_id":1794,"name":"Donald Ngo","email":"donald.ngo@hp.com","username":"donald-ngo"},"change_message_id":"3d4336d069683111df665ff8c5339d996c079df7","unresolved":false,"context_lines":[{"line_number":288,"context_line":"        except exceptions.BadRequest:"},{"line_number":289,"context_line":"            pass"},{"line_number":290,"context_line":"        else:"},{"line_number":291,"context_line":"            self.fail(\u0027Server was created with nonexistent security group\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAM3%2F%2FAL4%3D","line":291,"in_reply_to":"AAAAM3%2F%2FDME%3D","updated":"2013-02-11 22:15:23.000000000","message":"The style checked in produces a cleaner error message:\n\n_StringException: Traceback (most recent call last):\n  File \"/home/donald/source/tempest/tempest/tests/compute/servers/test_servers_negative_donald.py\", line 52, in test_create_with_nonexistent_security_group\n    self.fail(\u0027Server was created with security group that does not exist\u0027)\nAssertionError: Server was created with security group that does not exist\n\nWhere as the assertRaises is:\n\n_StringException: Traceback (most recent call last):\n  File \"/home/donald/source/tempest/tempest/tests/compute/servers/test_servers_negative_donald.py\", line 45, in test_create_with_nonexistent_security_group\n    \u0027fail\u0027,self.image_ref,self.flavor_ref,security_groups\u003dsecurity_groups)\nMismatchError: \u003cbound method type.create_server_with_extras of \u003cclass \u0027tempest.tests.compute.servers.test_servers_negative_donald.ServersNegativeTest\u0027\u003e\u003e returned ({\u0027status\u0027: \u0027202\u0027, \u0027content-length\u0027: \u0027442\u0027, \u0027x-compute-request-id\u0027: \u0027req-e003276b-1ef8-483c-b7f2-af1e5192303e\u0027, \u0027location\u0027: \u0027http://15.185.112.29:8774/v2/51a64ec9ac434af9b987177c3d8e41b3/servers/630dabf2-6969-4ef5-b6ef-1ae168f134a6\u0027, \u0027date\u0027: \u0027Mon, 11 Feb 2013 22:02:21 GMT\u0027, \u0027content-type\u0027: \u0027application/json\u0027}, {u\u0027links\u0027: [{u\u0027href\u0027: u\u0027http://15.185.112.29:8774/v2/51a64ec9ac434af9b987177c3d8e41b3/servers/630dabf2-6969-4ef5-b6ef-1ae168f134a6\u0027, u\u0027rel\u0027: u\u0027self\u0027}, {u\u0027href\u0027: u\u0027http://15.185.112.29:8774/51a64ec9ac434af9b987177c3d8e41b3/servers/630dabf2-6969-4ef5-b6ef-1ae168f134a6\u0027, u\u0027rel\u0027: u\u0027bookmark\u0027}], u\u0027OS-DCF:diskConfig\u0027: u\u0027MANUAL\u0027, u\u0027id\u0027: u\u0027630dabf2-6969-4ef5-b6ef-1ae168f134a6\u0027, u\u0027security_groups\u0027: [{u\u0027name\u0027: u\u0027default\u0027}], u\u0027adminPass\u0027: u\u00276aYPUZj3cBvb\u0027})","commit_id":"2b0997b7a32d17afb67047022921150934c99c4a"},{"author":{"_account_id":2750,"name":"Sean Dague","email":"sean@dague.net","username":"sdague"},"change_message_id":"cec269e62f2bda8585ad9a2b13159652ee3e9e49","unresolved":false,"context_lines":[{"line_number":288,"context_line":"        except exceptions.BadRequest:"},{"line_number":289,"context_line":"            pass"},{"line_number":290,"context_line":"        else:"},{"line_number":291,"context_line":"            self.fail(\u0027Server was created with nonexistent security group\u0027)"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAM3%2F%2B%2FSo%3D","line":291,"updated":"2013-02-12 11:18:50.000000000","message":"This should be assertRaises","commit_id":"78bd7f5d4c2ad3ea7d53e60f6a581c375ed41286"},{"author":{"_account_id":2750,"name":"Sean Dague","email":"sean@dague.net","username":"sdague"},"change_message_id":"b7b7a95a654c1fa578cc1366d6da727598a706b2","unresolved":false,"context_lines":[{"line_number":288,"context_line":"        except exceptions.BadRequest:"},{"line_number":289,"context_line":"            pass"},{"line_number":290,"context_line":"        else:"},{"line_number":291,"context_line":"            self.fail(\u0027Server was created with nonexistent security group\u0027)"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAM3%2F%2B%2BF4%3D","line":291,"in_reply_to":"AAAAM3%2F%2B%2B9Q%3D","updated":"2013-02-12 21:30:15.000000000","message":"Is there a better testtools assert that lets you also specify message?","commit_id":"78bd7f5d4c2ad3ea7d53e60f6a581c375ed41286"},{"author":{"_account_id":4190,"name":"lifeless","email":"robertc@robertcollins.net","username":"lifeless"},"change_message_id":"b3c59a8fcb8a08a29f3942dea9b2b4271126a899","unresolved":false,"context_lines":[{"line_number":288,"context_line":"        except exceptions.BadRequest:"},{"line_number":289,"context_line":"            pass"},{"line_number":290,"context_line":"        else:"},{"line_number":291,"context_line":"            self.fail(\u0027Server was created with nonexistent security group\u0027)"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAM3%2F%2B%2BCk%3D","line":291,"in_reply_to":"AAAAM3%2F%2B%2BF4%3D","updated":"2013-02-12 21:50:19.000000000","message":"assertRaises doesn\u0027t have anywhere in its contract to specify a message sorry.\n\nHowever assertThat does,\nhttps://testtools.readthedocs.org/en/latest/for-test-authors.html#matchesexception\n\nself.assertThat(lambda:self.create_server_with_extras(\u0027fail\u0027,\n    self.image_ref,\n    self.flavor_ref,\n    security_groups\u003dsecurity_groups), MatchesException(exceptions.BadRequest),\n    \"Server was created with non-existent security group.\")\n\nhowever this will show that addendum even if a different exception is raised, because the message is annotating all failures, not the specific class of failure where no exception is raised but that one.\n\nWe could easily tweak ExpectedException (The exception trapping context manager) to also support a message, except I don\u0027t think its needed. I would write the test like this:\n\nwith ExpectedException(exceptions.BadRequest):\n    self.create_server_with_extras(\u0027fail\u0027,\n        self.image_ref,\n        self.flavor_ref,\n        security_groups\u003dsecurity_groups)\n    self.fail(\u0027Server was created with nonexistent security group\u0027)\n\nWhich will:\n - fail if the call succeeeds\n - pass if the call errors with BadRequest\n - fail if the call errors with a different exception.\n\nIf you also want to check that the error has some mention of security group in it, you can use\nwith ExpectedException(exceptions.BadRequest, \"security group\"):\n(or other pattern match, or even a matcher).","commit_id":"78bd7f5d4c2ad3ea7d53e60f6a581c375ed41286"},{"author":{"_account_id":1794,"name":"Donald Ngo","email":"donald.ngo@hp.com","username":"donald-ngo"},"change_message_id":"214b1bc2dac248ec9f57257bb3a2c0472f443b52","unresolved":false,"context_lines":[{"line_number":288,"context_line":"        except exceptions.BadRequest:"},{"line_number":289,"context_line":"            pass"},{"line_number":290,"context_line":"        else:"},{"line_number":291,"context_line":"            self.fail(\u0027Server was created with nonexistent security group\u0027)"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAM3%2F%2B%2B9Q%3D","line":291,"in_reply_to":"AAAAM3%2F%2B%2FSo%3D","updated":"2013-02-12 15:16:35.000000000","message":"Sean - The output of the two styles are below. The assertRaises exception is unclear of what the error actually is. The first style is much cleaner. What do you think?\n\nCurrent:\n\n_StringException: Traceback (most recent call last):\n  File \"/home/donald/source/tempest/tempest/tests/compute/servers/test_servers_negative_donald.py\", line 52, in test_create_with_nonexistent_security_group\n    self.fail(\u0027Server was created with security group that does not exist\u0027)\nAssertionError: Server was created with security group that does not exist\n\n\nassertRaises:\n\n_StringException: Traceback (most recent call last):\n  File \"/home/donald/source/tempest/tempest/tests/compute/servers/test_servers_negative_donald.py\", line 45, in test_create_with_nonexistent_security_group\n    \u0027fail\u0027,self.image_ref,self.flavor_ref,security_groups\u003dsecurity_groups)\nMismatchError: \u003cbound method type.create_server_with_extras of \u003cclass \u0027tempest.tests.compute.servers.test_servers_negative_donald.ServersNegativeTest\u0027\u003e\u003e returned ({\u0027status\u0027: \u0027202\u0027, \u0027content-length\u0027: \u0027442\u0027, \u0027x-compute-request-id\u0027: \u0027req-e003276b-1ef8-483c-b7f2-af1e5192303e\u0027, \u0027location\u0027: \u0027http://15.185.112.29:8774/v2/51a64ec9ac434af9b987177c3d8e41b3/servers/630dabf2-6969-4ef5-b6ef-1ae168f134a6\u0027, \u0027date\u0027: \u0027Mon, 11 Feb 2013 22:02:21 GMT\u0027, \u0027content-type\u0027: \u0027application/json\u0027}, {u\u0027links\u0027: [{u\u0027href\u0027: u\u0027http://15.185.112.29:8774/v2/51a64ec9ac434af9b987177c3d8e41b3/servers/630dabf2-6969-4ef5-b6ef-1ae168f134a6\u0027, u\u0027rel\u0027: u\u0027self\u0027}, {u\u0027href\u0027: u\u0027http://15.185.112.29:8774/51a64ec9ac434af9b987177c3d8e41b3/servers/630dabf2-6969-4ef5-b6ef-1ae168f134a6\u0027, u\u0027rel\u0027: u\u0027bookmark\u0027}], u\u0027OS-DCF:diskConfig\u0027: u\u0027MANUAL\u0027, u\u0027id\u0027: u\u0027630dabf2-6969-4ef5-b6ef-1ae168f134a6\u0027, u\u0027security_groups\u0027: [{u\u0027name\u0027: u\u0027default\u0027}], u\u0027adminPass\u0027: u\u00276aYPUZj3cBvb\u0027})","commit_id":"78bd7f5d4c2ad3ea7d53e60f6a581c375ed41286"}]}
