)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"6140111cd9860a72d2b90ad592b860703881a971","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Federico Ressi \u003cfederico.ressi@intel.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2016-03-11 15:09:14 +0000"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Write MechanismManager.bind_port unit tests"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"With the purpose of better understanding how ML2 port binding"},{"line_number":10,"context_line":"works (or it is expected too) I am writing some unit test to"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":12,"id":"3afc51ec_cc7c3023","line":7,"updated":"2016-03-12 14:06:43.000000000","message":"Did you consider writing something like:\nneutron.tests.functional.plugins.ml2.test_plugin instead of these mock heavy tests?\n\nI encourage you to read:\nhttp://docs.openstack.org/developer/neutron/devref/development.environment.html#testing-neutron\n\nIn this case I think you can write more effective tests using the unit testing framework, without excessive usage of mocks, and I see neutron.tests.functional.plugins.ml2.test_plugin as good examples. We put those tests in the functional directory because of the scope of the tests, even though it uses the unit testing base classes.","commit_id":"7dd6bc18933ae98dfc0d63dd8298180bf971ef6e"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"3c1e1fe324d21ba0f98d9a1962ea37325388eedc","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Federico Ressi \u003cfederico.ressi@intel.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2016-03-11 15:09:14 +0000"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Write MechanismManager.bind_port unit tests"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"With the purpose of better understanding how ML2 port binding"},{"line_number":10,"context_line":"works (or it is expected too) I am writing some unit test to"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":12,"id":"3afc51ec_edf63cd6","line":7,"in_reply_to":"3afc51ec_6fc184e4","updated":"2016-03-13 19:31:45.000000000","message":"I agree with everything that you said. However, if you are forced to use mock to validate behavior of functions, it suggests that we should either refactor the code to improve testability, that mock was used excessively and that it is in fact possible to test methods without it (i.e. test method input and output, not internal methods that it calls out), or that a different testing strategy would be more effective.\n\nWe\u0027ve been moving away from the status quo of adding new mock heavy tests, and I wouldn\u0027t want to deviate from that here. The rationale behind this move, and the short comings of mock heavy testing are explained in the document I linked above (That I wrote).","commit_id":"7dd6bc18933ae98dfc0d63dd8298180bf971ef6e"},{"author":{"_account_id":17377,"name":"Federico Ressi","email":"federico.ressi@intel.com","username":"fressi"},"change_message_id":"6267f3013965886602c15e37f59b9c5407d741b2","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Federico Ressi \u003cfederico.ressi@intel.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2016-03-11 15:09:14 +0000"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Write MechanismManager.bind_port unit tests"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"With the purpose of better understanding how ML2 port binding"},{"line_number":10,"context_line":"works (or it is expected too) I am writing some unit test to"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":12,"id":"3afc51ec_6fc184e4","line":7,"in_reply_to":"3afc51ec_cc7c3023","updated":"2016-03-13 16:26:29.000000000","message":"Unit tests and functional tests has different purposes. There are already functional tests that cover this code. This is an unit test and its purpose is to check current implementation of one single class behave as expected, whatever the rest o the code is changed. The scope of a unit test is smaller than the scope of a functional test. Therefore unit tests are easier to write and maintain for complex behaviour and detect some kind of bugs that functional tests would hardly detect. The reason is because even if the internal behaviour of a class would be different from what intended by developer the final functional state could be the same an therefore the test passed also it would not be intended to.\nUnit tests are really good for reaching levels as 100% of code coverage, while functional tests are good to cover other goals and we should have both.","commit_id":"7dd6bc18933ae98dfc0d63dd8298180bf971ef6e"}],"neutron/tests/unit/plugins/ml2/test_managers.py":[{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"7c14b035e845b3c25d3ce4a8249a7cd0e4db29f4","unresolved":false,"context_lines":[{"line_number":68,"context_line":"        given_manager.bind_port(given_context)"},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"        # Then it should not hit the _prepare_to_bind"},{"line_number":71,"context_line":"        self.assertFalse(given_context._prepare_to_bind.called)"},{"line_number":72,"context_line":"        self.log.error.assert_called_once_with("},{"line_number":73,"context_line":"            \u0027Failed to bind port %(port)s on host %(host)s for vnic_type \u0027"},{"line_number":74,"context_line":"            \u0027%(vnic_type)s using segments %(segments)s\u0027,"}],"source_content_type":"text/x-python","patch_set":9,"id":"5aef4532_8a9a3812","line":71,"updated":"2016-03-11 03:19:56.000000000","message":"assert_no_called() can be used.","commit_id":"eefc3fcdae6bcda6f2f30b7450214986203ebefe"},{"author":{"_account_id":17377,"name":"Federico Ressi","email":"federico.ressi@intel.com","username":"fressi"},"change_message_id":"cfd94d2ec48fee1a3ea6acd44a91137f17826ec0","unresolved":false,"context_lines":[{"line_number":68,"context_line":"        given_manager.bind_port(given_context)"},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"        # Then it should not hit the _prepare_to_bind"},{"line_number":71,"context_line":"        self.assertFalse(given_context._prepare_to_bind.called)"},{"line_number":72,"context_line":"        self.log.error.assert_called_once_with("},{"line_number":73,"context_line":"            \u0027Failed to bind port %(port)s on host %(host)s for vnic_type \u0027"},{"line_number":74,"context_line":"            \u0027%(vnic_type)s using segments %(segments)s\u0027,"}],"source_content_type":"text/x-python","patch_set":9,"id":"3afc51ec_02fe0e6b","line":71,"in_reply_to":"5aef4532_8a9a3812","updated":"2016-03-11 12:03:47.000000000","message":"Done","commit_id":"eefc3fcdae6bcda6f2f30b7450214986203ebefe"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"7c14b035e845b3c25d3ce4a8249a7cd0e4db29f4","unresolved":false,"context_lines":[{"line_number":102,"context_line":"        given_driver \u003d mock_mechanism_driver()"},{"line_number":103,"context_line":"        given_manager \u003d self.create_manager(drivers\u003d[given_driver])"},{"line_number":104,"context_line":"        given_context \u003d mock_port_context()"},{"line_number":105,"context_line":" "},{"line_number":106,"context_line":"        # When manager try binding port using given driver and context"},{"line_number":107,"context_line":"        given_manager.bind_port(given_context)"},{"line_number":108,"context_line":" "}],"source_content_type":"text/x-python","patch_set":9,"id":"5aef4532_4a703040","line":105,"updated":"2016-03-11 03:19:56.000000000","message":"nit: extra white space","commit_id":"eefc3fcdae6bcda6f2f30b7450214986203ebefe"},{"author":{"_account_id":17377,"name":"Federico Ressi","email":"federico.ressi@intel.com","username":"fressi"},"change_message_id":"cfd94d2ec48fee1a3ea6acd44a91137f17826ec0","unresolved":false,"context_lines":[{"line_number":102,"context_line":"        given_driver \u003d mock_mechanism_driver()"},{"line_number":103,"context_line":"        given_manager \u003d self.create_manager(drivers\u003d[given_driver])"},{"line_number":104,"context_line":"        given_context \u003d mock_port_context()"},{"line_number":105,"context_line":" "},{"line_number":106,"context_line":"        # When manager try binding port using given driver and context"},{"line_number":107,"context_line":"        given_manager.bind_port(given_context)"},{"line_number":108,"context_line":" "}],"source_content_type":"text/x-python","patch_set":9,"id":"3afc51ec_65e27ca1","line":105,"in_reply_to":"5aef4532_4a703040","updated":"2016-03-11 12:03:47.000000000","message":"Done","commit_id":"eefc3fcdae6bcda6f2f30b7450214986203ebefe"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"7c14b035e845b3c25d3ce4a8249a7cd0e4db29f4","unresolved":false,"context_lines":[{"line_number":141,"context_line":""},{"line_number":142,"context_line":"    def test_bind_port_with_one_driver_failing_up_to_max_levels(self):"},{"line_number":143,"context_line":"        given_segments \u003d self.create_segments("},{"line_number":144,"context_line":"            segment_ids\u003d[\u0027SEGMENT1\u0027, \u0027SEGMENT2\u0027, \u0027SEGMENT3\u0027])"},{"line_number":145,"context_line":"        given_driver \u003d mock_mechanism_driver()"},{"line_number":146,"context_line":"        given_manager \u003d self.create_manager(drivers\u003d[given_driver])"},{"line_number":147,"context_line":"        given_context \u003d mock_port_context("}],"source_content_type":"text/x-python","patch_set":9,"id":"5aef4532_a5d2c759","line":144,"updated":"2016-03-11 03:19:56.000000000","message":"Does 3 segments have meaning?\nwhat\u0027s the relationship to line 150?","commit_id":"eefc3fcdae6bcda6f2f30b7450214986203ebefe"},{"author":{"_account_id":17377,"name":"Federico Ressi","email":"federico.ressi@intel.com","username":"fressi"},"change_message_id":"cfd94d2ec48fee1a3ea6acd44a91137f17826ec0","unresolved":false,"context_lines":[{"line_number":141,"context_line":""},{"line_number":142,"context_line":"    def test_bind_port_with_one_driver_failing_up_to_max_levels(self):"},{"line_number":143,"context_line":"        given_segments \u003d self.create_segments("},{"line_number":144,"context_line":"            segment_ids\u003d[\u0027SEGMENT1\u0027, \u0027SEGMENT2\u0027, \u0027SEGMENT3\u0027])"},{"line_number":145,"context_line":"        given_driver \u003d mock_mechanism_driver()"},{"line_number":146,"context_line":"        given_manager \u003d self.create_manager(drivers\u003d[given_driver])"},{"line_number":147,"context_line":"        given_context \u003d mock_port_context("}],"source_content_type":"text/x-python","patch_set":9,"id":"3afc51ec_c54c3079","line":144,"in_reply_to":"5aef4532_a5d2c759","updated":"2016-03-11 12:03:47.000000000","message":"We need at least one segment to produce recursive calls.","commit_id":"eefc3fcdae6bcda6f2f30b7450214986203ebefe"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"7c14b035e845b3c25d3ce4a8249a7cd0e4db29f4","unresolved":false,"context_lines":[{"line_number":147,"context_line":"        given_context \u003d mock_port_context("},{"line_number":148,"context_line":"            network_segments\u003dgiven_segments,"},{"line_number":149,"context_line":"            new_bound_segment\u003dgiven_segments[0][driver_api.SEGMENTATION_ID],"},{"line_number":150,"context_line":"            next_segments_to_bind\u003dgiven_segments[1:])"},{"line_number":151,"context_line":""},{"line_number":152,"context_line":"        # When manager try to bind port using given driver and context"},{"line_number":153,"context_line":"        given_manager.bind_port(given_context)"}],"source_content_type":"text/x-python","patch_set":9,"id":"5aef4532_45e14329","line":150,"updated":"2016-03-11 03:19:56.000000000","message":"Can we just return given_segmens?","commit_id":"eefc3fcdae6bcda6f2f30b7450214986203ebefe"},{"author":{"_account_id":17377,"name":"Federico Ressi","email":"federico.ressi@intel.com","username":"fressi"},"change_message_id":"cfd94d2ec48fee1a3ea6acd44a91137f17826ec0","unresolved":false,"context_lines":[{"line_number":147,"context_line":"        given_context \u003d mock_port_context("},{"line_number":148,"context_line":"            network_segments\u003dgiven_segments,"},{"line_number":149,"context_line":"            new_bound_segment\u003dgiven_segments[0][driver_api.SEGMENTATION_ID],"},{"line_number":150,"context_line":"            next_segments_to_bind\u003dgiven_segments[1:])"},{"line_number":151,"context_line":""},{"line_number":152,"context_line":"        # When manager try to bind port using given driver and context"},{"line_number":153,"context_line":"        given_manager.bind_port(given_context)"}],"source_content_type":"text/x-python","patch_set":9,"id":"3afc51ec_05b458f0","line":150,"in_reply_to":"5aef4532_45e14329","updated":"2016-03-11 12:03:47.000000000","message":"Done.","commit_id":"eefc3fcdae6bcda6f2f30b7450214986203ebefe"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"7c14b035e845b3c25d3ce4a8249a7cd0e4db29f4","unresolved":false,"context_lines":[{"line_number":241,"context_line":"                {\u0027port\u0027: \u0027CURRENT_ID\u0027, \u0027host\u0027: \u0027HOST\u0027,"},{"line_number":242,"context_line":"                 \u0027binding_levels\u0027: mock.ANY, \u0027vif_type\u0027: mock.ANY,"},{"line_number":243,"context_line":"                 \u0027vif_details\u0027: mock.ANY})],"},{"line_number":244,"context_line":"            self.log.debug.mock_calls)"},{"line_number":245,"context_line":""},{"line_number":246,"context_line":"    def test_bind_port_with_one_driver_failing_bind_port(self):"},{"line_number":247,"context_line":"        given_segments \u003d self.create_manager("}],"source_content_type":"text/x-python","patch_set":9,"id":"5aef4532_05ad7be8","line":244,"updated":"2016-03-11 03:19:56.000000000","message":"assert_has_calls()","commit_id":"eefc3fcdae6bcda6f2f30b7450214986203ebefe"},{"author":{"_account_id":17377,"name":"Federico Ressi","email":"federico.ressi@intel.com","username":"fressi"},"change_message_id":"52088160e108613bdb1f15b55156138999fb56ac","unresolved":false,"context_lines":[{"line_number":31,"context_line":"        super(TestMechanismManager, self).setUp()"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":"        self.cfg \u003d mocked_cfg \u003d mock.Mock()"},{"line_number":34,"context_line":"        self.cfg.CONF.ml2.mechanism_drivers \u003d []"},{"line_number":35,"context_line":"        mock.patch.object(managers, \u0027cfg\u0027, mocked_cfg).start()"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"        self.log \u003d mocked_log \u003d mock.Mock(specs\u003dlogging.Logger)"}],"source_content_type":"text/x-python","patch_set":12,"id":"3afc51ec_9620759d","line":34,"range":{"start_line":34,"start_character":8,"end_line":34,"end_character":16},"updated":"2016-03-12 09:05:44.000000000","message":"self.cfg is mocked_cfg","commit_id":"7dd6bc18933ae98dfc0d63dd8298180bf971ef6e"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"6140111cd9860a72d2b90ad592b860703881a971","unresolved":false,"context_lines":[{"line_number":69,"context_line":""},{"line_number":70,"context_line":"        # Then it should not hit the _prepare_to_bind"},{"line_number":71,"context_line":"        given_context._prepare_to_bind.assert_not_called()"},{"line_number":72,"context_line":"        self.log.error.assert_called_once_with("},{"line_number":73,"context_line":"            \u0027Failed to bind port %(port)s on host %(host)s for vnic_type \u0027"},{"line_number":74,"context_line":"            \u0027%(vnic_type)s using segments %(segments)s\u0027,"},{"line_number":75,"context_line":"            {\u0027vnic_type\u0027: \u0027VNIC_TYPE\u0027, \u0027port\u0027: \u0027CURRENT_ID\u0027, \u0027segments\u0027: [],"}],"source_content_type":"text/x-python","patch_set":12,"id":"3afc51ec_ec9c8c6b","line":72,"updated":"2016-03-12 14:06:43.000000000","message":"We do not assert logging usage in Neutron.","commit_id":"7dd6bc18933ae98dfc0d63dd8298180bf971ef6e"},{"author":{"_account_id":17377,"name":"Federico Ressi","email":"federico.ressi@intel.com","username":"fressi"},"change_message_id":"4ea6c37086b6ebbd2aeb483e30fa94edb086369c","unresolved":false,"context_lines":[{"line_number":69,"context_line":""},{"line_number":70,"context_line":"        # Then it should not hit the _prepare_to_bind"},{"line_number":71,"context_line":"        given_context._prepare_to_bind.assert_not_called()"},{"line_number":72,"context_line":"        self.log.error.assert_called_once_with("},{"line_number":73,"context_line":"            \u0027Failed to bind port %(port)s on host %(host)s for vnic_type \u0027"},{"line_number":74,"context_line":"            \u0027%(vnic_type)s using segments %(segments)s\u0027,"},{"line_number":75,"context_line":"            {\u0027vnic_type\u0027: \u0027VNIC_TYPE\u0027, \u0027port\u0027: \u0027CURRENT_ID\u0027, \u0027segments\u0027: [],"}],"source_content_type":"text/x-python","patch_set":12,"id":"3afc51ec_5b6f1cc5","line":72,"in_reply_to":"3afc51ec_4d0490bf","updated":"2016-03-14 08:26:18.000000000","message":"Then this test would not have any assert then I would be really hard to understand what it is tested here. Tests that simply execute code without checking what is going on is what do you want? I am sorry but for this specific test (test_bind_port_with_no_drivers) I strongly disagree.\n\nCalling LOG.error is an expected behaviour, not just an implementation details and therefore has to be tested.The execution of that specific line has a business value for final user.","commit_id":"7dd6bc18933ae98dfc0d63dd8298180bf971ef6e"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"3c1e1fe324d21ba0f98d9a1962ea37325388eedc","unresolved":false,"context_lines":[{"line_number":69,"context_line":""},{"line_number":70,"context_line":"        # Then it should not hit the _prepare_to_bind"},{"line_number":71,"context_line":"        given_context._prepare_to_bind.assert_not_called()"},{"line_number":72,"context_line":"        self.log.error.assert_called_once_with("},{"line_number":73,"context_line":"            \u0027Failed to bind port %(port)s on host %(host)s for vnic_type \u0027"},{"line_number":74,"context_line":"            \u0027%(vnic_type)s using segments %(segments)s\u0027,"},{"line_number":75,"context_line":"            {\u0027vnic_type\u0027: \u0027VNIC_TYPE\u0027, \u0027port\u0027: \u0027CURRENT_ID\u0027, \u0027segments\u0027: [],"}],"source_content_type":"text/x-python","patch_set":12,"id":"3afc51ec_4d0490bf","line":72,"in_reply_to":"3afc51ec_9274f39c","updated":"2016-03-13 19:31:45.000000000","message":"\u003e All python line of code should be tested because every line could produce an unexpected execution path by simply raising an exception.\n\nIt should have implicit coverage (i.e. the code should be executed so that we make sure it is syntactically correct and doesn\u0027t raise an exception), but not explicitly asserted via mock.","commit_id":"7dd6bc18933ae98dfc0d63dd8298180bf971ef6e"},{"author":{"_account_id":17377,"name":"Federico Ressi","email":"federico.ressi@intel.com","username":"fressi"},"change_message_id":"6267f3013965886602c15e37f59b9c5407d741b2","unresolved":false,"context_lines":[{"line_number":69,"context_line":""},{"line_number":70,"context_line":"        # Then it should not hit the _prepare_to_bind"},{"line_number":71,"context_line":"        given_context._prepare_to_bind.assert_not_called()"},{"line_number":72,"context_line":"        self.log.error.assert_called_once_with("},{"line_number":73,"context_line":"            \u0027Failed to bind port %(port)s on host %(host)s for vnic_type \u0027"},{"line_number":74,"context_line":"            \u0027%(vnic_type)s using segments %(segments)s\u0027,"},{"line_number":75,"context_line":"            {\u0027vnic_type\u0027: \u0027VNIC_TYPE\u0027, \u0027port\u0027: \u0027CURRENT_ID\u0027, \u0027segments\u0027: [],"}],"source_content_type":"text/x-python","patch_set":12,"id":"3afc51ec_9274f39c","line":72,"in_reply_to":"3afc51ec_ec9c8c6b","updated":"2016-03-13 16:26:29.000000000","message":"All python line of code should be tested because every line could produce an unexpected execution path by simply raising an exception.\n\nThe code I am testing doesn\u0027t produce a specific result for every executions paths and to test it without changing the code I had to use whatever the code does different to assure execution path hit it.\n\nI am not a strong fan of mocking LOG.debug method, but LOG.error and LOG.exception should be considered part of the behaviour of the code as their message are expected to reach final user and help him on understanding what it is going wrong.","commit_id":"7dd6bc18933ae98dfc0d63dd8298180bf971ef6e"},{"author":{"_account_id":17377,"name":"Federico Ressi","email":"federico.ressi@intel.com","username":"fressi"},"change_message_id":"52088160e108613bdb1f15b55156138999fb56ac","unresolved":false,"context_lines":[{"line_number":89,"context_line":"        given_manager.bind_port(given_context)"},{"line_number":90,"context_line":""},{"line_number":91,"context_line":"        # Then it should not hit the _prepare_to_bind"},{"line_number":92,"context_line":"        self.assertFalse(given_context._prepare_to_bind.called)"},{"line_number":93,"context_line":"        # Then it should not ask driver to bind port"},{"line_number":94,"context_line":"        self.assertFalse(given_driver.obj.bind_port.called)"},{"line_number":95,"context_line":"        self.log.error.assert_called_once_with("}],"source_content_type":"text/x-python","patch_set":12,"id":"3afc51ec_b63e51b6","line":92,"range":{"start_line":92,"start_character":8,"end_line":92,"end_character":63},"updated":"2016-03-12 09:05:44.000000000","message":"given_context._prepare_to_bind.assert_not_called()","commit_id":"7dd6bc18933ae98dfc0d63dd8298180bf971ef6e"},{"author":{"_account_id":17377,"name":"Federico Ressi","email":"federico.ressi@intel.com","username":"fressi"},"change_message_id":"52088160e108613bdb1f15b55156138999fb56ac","unresolved":false,"context_lines":[{"line_number":91,"context_line":"        # Then it should not hit the _prepare_to_bind"},{"line_number":92,"context_line":"        self.assertFalse(given_context._prepare_to_bind.called)"},{"line_number":93,"context_line":"        # Then it should not ask driver to bind port"},{"line_number":94,"context_line":"        self.assertFalse(given_driver.obj.bind_port.called)"},{"line_number":95,"context_line":"        self.log.error.assert_called_once_with("},{"line_number":96,"context_line":"            \u0027Failed to bind port %(port)s on host %(host)s for vnic_type \u0027"},{"line_number":97,"context_line":"            \u0027%(vnic_type)s using segments %(segments)s\u0027,"}],"source_content_type":"text/x-python","patch_set":12,"id":"3afc51ec_f648d95d","line":94,"range":{"start_line":94,"start_character":8,"end_line":94,"end_character":59},"updated":"2016-03-12 09:05:44.000000000","message":"given_driver.obj.bind_port.assert_not_called()","commit_id":"7dd6bc18933ae98dfc0d63dd8298180bf971ef6e"},{"author":{"_account_id":17377,"name":"Federico Ressi","email":"federico.ressi@intel.com","username":"fressi"},"change_message_id":"52088160e108613bdb1f15b55156138999fb56ac","unresolved":false,"context_lines":[{"line_number":132,"context_line":"        new_building_level \u003d given_binding_levels.pop()"},{"line_number":133,"context_line":"        given_context._push_binding_level.assert_called_once_with("},{"line_number":134,"context_line":"            new_building_level)"},{"line_number":135,"context_line":"        self.assertIs(given_driver.name, new_building_level.driver)"},{"line_number":136,"context_line":"        self.assertEqual(\u0027NEW_SEGMENT\u0027, new_building_level.segment_id)"},{"line_number":137,"context_line":"        # Then no error or warning are reported"},{"line_number":138,"context_line":"        self.assertFalse(self.log.exceptions.called)"}],"source_content_type":"text/x-python","patch_set":12,"id":"3afc51ec_966eb5c7","line":135,"range":{"start_line":135,"start_character":13,"end_line":135,"end_character":21},"updated":"2016-03-12 09:05:44.000000000","message":"assertEqual would be enought","commit_id":"7dd6bc18933ae98dfc0d63dd8298180bf971ef6e"},{"author":{"_account_id":17377,"name":"Federico Ressi","email":"federico.ressi@intel.com","username":"fressi"},"change_message_id":"52088160e108613bdb1f15b55156138999fb56ac","unresolved":false,"context_lines":[{"line_number":135,"context_line":"        self.assertIs(given_driver.name, new_building_level.driver)"},{"line_number":136,"context_line":"        self.assertEqual(\u0027NEW_SEGMENT\u0027, new_building_level.segment_id)"},{"line_number":137,"context_line":"        # Then no error or warning are reported"},{"line_number":138,"context_line":"        self.assertFalse(self.log.exceptions.called)"},{"line_number":139,"context_line":"        self.assertFalse(self.log.error.called)"},{"line_number":140,"context_line":"        self.assertFalse(self.log.warning.called)"},{"line_number":141,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"3afc51ec_767329b2","line":138,"range":{"start_line":138,"start_character":8,"end_line":138,"end_character":52},"updated":"2016-03-12 09:05:44.000000000","message":"assert_not_called()","commit_id":"7dd6bc18933ae98dfc0d63dd8298180bf971ef6e"},{"author":{"_account_id":17377,"name":"Federico Ressi","email":"federico.ressi@intel.com","username":"fressi"},"change_message_id":"52088160e108613bdb1f15b55156138999fb56ac","unresolved":false,"context_lines":[{"line_number":196,"context_line":"        given_context \u003d mock_port_context("},{"line_number":197,"context_line":"            network_segments\u003dgiven_segments,"},{"line_number":198,"context_line":"            new_bound_segment\u003dgiven_segments[0],"},{"line_number":199,"context_line":"            next_segments_to_bind\u003dproperty(),"},{"line_number":200,"context_line":"            binding_levels\u003dgiven_binding_levels)"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"        # When manager try to bind port using given driver and context"}],"source_content_type":"text/x-python","patch_set":12,"id":"3afc51ec_96a51506","line":199,"range":{"start_line":199,"start_character":12,"end_line":199,"end_character":44},"updated":"2016-03-12 09:05:44.000000000","message":"next_segments_to_bind and new_bound_segment are replaced at lines 189 and  191","commit_id":"7dd6bc18933ae98dfc0d63dd8298180bf971ef6e"},{"author":{"_account_id":17377,"name":"Federico Ressi","email":"federico.ressi@intel.com","username":"fressi"},"change_message_id":"52088160e108613bdb1f15b55156138999fb56ac","unresolved":false,"context_lines":[{"line_number":219,"context_line":"                [mock.call(level) for level in given_binding_levels],"},{"line_number":220,"context_line":"                given_context._push_binding_level.mock_calls)"},{"line_number":221,"context_line":""},{"line_number":222,"context_line":"        self.assertFalse(self.log.error.called)"},{"line_number":223,"context_line":"        self.assertFalse(self.log.warning.called)"},{"line_number":224,"context_line":"        self.log.debug.assert_has_calls("},{"line_number":225,"context_line":"            [mock.call("},{"line_number":226,"context_line":"                \u0027Attempting to bind port %(port)s on host %(host)s for \u0027"}],"source_content_type":"text/x-python","patch_set":12,"id":"3afc51ec_3687e162","line":223,"range":{"start_line":222,"start_character":8,"end_line":223,"end_character":49},"updated":"2016-03-12 09:05:44.000000000","message":"assert_not_called()","commit_id":"7dd6bc18933ae98dfc0d63dd8298180bf971ef6e"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"f076f2ded11f7266ebd83c6cfe2783c6bb4070fd","unresolved":false,"context_lines":[{"line_number":14,"context_line":"#    License for the specific language governing permissions and limitations"},{"line_number":15,"context_line":"#    under the License."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"import logging"},{"line_number":18,"context_line":"import sys"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"import mock"}],"source_content_type":"text/x-python","patch_set":13,"id":"3afc51ec_176ef100","line":17,"updated":"2016-03-14 14:54:06.000000000","message":"why not oslo_log?","commit_id":"d3920409a3b11a52e82b9aedcd0465c2e36dd025"},{"author":{"_account_id":17377,"name":"Federico Ressi","email":"federico.ressi@intel.com","username":"fressi"},"change_message_id":"4e079a58a693dcb2b30e101b6641d18e0d59e1ff","unresolved":false,"context_lines":[{"line_number":14,"context_line":"#    License for the specific language governing permissions and limitations"},{"line_number":15,"context_line":"#    under the License."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"import logging"},{"line_number":18,"context_line":"import sys"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"import mock"}],"source_content_type":"text/x-python","patch_set":13,"id":"3afc51ec_92ab2f1d","line":17,"in_reply_to":"3afc51ec_176ef100","updated":"2016-03-14 15:13:46.000000000","message":"done","commit_id":"d3920409a3b11a52e82b9aedcd0465c2e36dd025"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"f076f2ded11f7266ebd83c6cfe2783c6bb4070fd","unresolved":false,"context_lines":[{"line_number":69,"context_line":""},{"line_number":70,"context_line":"        # Then it should not hit the _prepare_to_bind"},{"line_number":71,"context_line":"        given_context._prepare_to_bind.assert_not_called()"},{"line_number":72,"context_line":"        self.log.error.assert_called_once_with("},{"line_number":73,"context_line":"            \u0027Failed to bind port %(port)s on host %(host)s for vnic_type \u0027"},{"line_number":74,"context_line":"            \u0027%(vnic_type)s using segments %(segments)s\u0027,"},{"line_number":75,"context_line":"            {\u0027vnic_type\u0027: \u0027VNIC_TYPE\u0027, \u0027port\u0027: \u0027CURRENT_ID\u0027, \u0027segments\u0027: [],"}],"source_content_type":"text/x-python","patch_set":13,"id":"3afc51ec_d2ff77ff","line":72,"updated":"2016-03-14 14:54:06.000000000","message":"i am not sure what value this gives us. in the edn its a pain when one changes the log message","commit_id":"d3920409a3b11a52e82b9aedcd0465c2e36dd025"},{"author":{"_account_id":17377,"name":"Federico Ressi","email":"federico.ressi@intel.com","username":"fressi"},"change_message_id":"4e079a58a693dcb2b30e101b6641d18e0d59e1ff","unresolved":false,"context_lines":[{"line_number":69,"context_line":""},{"line_number":70,"context_line":"        # Then it should not hit the _prepare_to_bind"},{"line_number":71,"context_line":"        given_context._prepare_to_bind.assert_not_called()"},{"line_number":72,"context_line":"        self.log.error.assert_called_once_with("},{"line_number":73,"context_line":"            \u0027Failed to bind port %(port)s on host %(host)s for vnic_type \u0027"},{"line_number":74,"context_line":"            \u0027%(vnic_type)s using segments %(segments)s\u0027,"},{"line_number":75,"context_line":"            {\u0027vnic_type\u0027: \u0027VNIC_TYPE\u0027, \u0027port\u0027: \u0027CURRENT_ID\u0027, \u0027segments\u0027: [],"}],"source_content_type":"text/x-python","patch_set":13,"id":"3afc51ec_1828e1e1","line":72,"in_reply_to":"3afc51ec_d2ff77ff","updated":"2016-03-14 15:13:46.000000000","message":"If you edit managers module you are expected to at least run/fits its unit test. If you change the text of a log message you have to test that it is well formatted as you expect. Having a unit test that give you an error will force you to modify the unit test too to force you it is giving the text you expected.\n\nLog errors are part of the behaviour the end user should be interested in having and understanding. Changing text is like changing a behaviour that is visible to end user and therefore should be tested. I am agree with you for debug messages because the goal in that case is to help the developer and not the user in understanding what it is going on.\n\nIn the specific case of this test logging is the only line executed that could give us a prove that something has goon wrong. As the purpose of this works is testing the code as it is and not changing it, this should be an acceptable workaround until tested code is not properly refactored to be more testeable","commit_id":"d3920409a3b11a52e82b9aedcd0465c2e36dd025"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"f076f2ded11f7266ebd83c6cfe2783c6bb4070fd","unresolved":false,"context_lines":[{"line_number":92,"context_line":"        given_context._prepare_to_bind.assert_not_called()"},{"line_number":93,"context_line":"        # Then it should not ask driver to bind port"},{"line_number":94,"context_line":"        given_driver.obj.bind_port.assert_not_called()"},{"line_number":95,"context_line":"        self.log.error.assert_called_once_with("},{"line_number":96,"context_line":"            \u0027Failed to bind port %(port)s on host %(host)s for vnic_type \u0027"},{"line_number":97,"context_line":"            \u0027%(vnic_type)s using segments %(segments)s\u0027,"},{"line_number":98,"context_line":"            {\u0027vnic_type\u0027: \u0027VNIC_TYPE\u0027, \u0027port\u0027: \u0027CURRENT_ID\u0027,"}],"source_content_type":"text/x-python","patch_set":13,"id":"3afc51ec_52140743","line":95,"updated":"2016-03-14 14:54:06.000000000","message":"ditto","commit_id":"d3920409a3b11a52e82b9aedcd0465c2e36dd025"}]}
