)]}'
{"ironic/common/utils.py":[{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"5d669c8fbcc0b104db4dbf0b55b2e6209e137633","unresolved":false,"context_lines":[{"line_number":216,"context_line":""},{"line_number":217,"context_line":""},{"line_number":218,"context_line":"def validate_and_normalize_mac(address):"},{"line_number":219,"context_line":"    \"\"\"Normalizes and check if a MAC address is valid."},{"line_number":220,"context_line":""},{"line_number":221,"context_line":"    Checks whether the supplied MAC address is formally correct and"},{"line_number":222,"context_line":"    normalize it to all lower case."}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F9Z8o%3D","line":219,"updated":"2013-12-11 21:24:54.000000000","message":"The code checks validity first, then normalizes. Might be nice if the docstring described it in that order too.\n\nBonus points if you get the verb tenses to be the same (normalizes, checks...) ;)","commit_id":"da43a1f0dd0fc7e51eed5f50a2670bf894585101"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"5ee96d3edc35f1f035f1710ea98768dba22d00e9","unresolved":false,"context_lines":[{"line_number":216,"context_line":""},{"line_number":217,"context_line":""},{"line_number":218,"context_line":"def validate_and_normalize_mac(address):"},{"line_number":219,"context_line":"    \"\"\"Normalizes and check if a MAC address is valid."},{"line_number":220,"context_line":""},{"line_number":221,"context_line":"    Checks whether the supplied MAC address is formally correct and"},{"line_number":222,"context_line":"    normalize it to all lower case."}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F9Wto%3D","line":219,"in_reply_to":"AAAATn%2F9Z8o%3D","updated":"2013-12-12 10:42:36.000000000","message":"heh fair! Will do thanks :)","commit_id":"da43a1f0dd0fc7e51eed5f50a2670bf894585101"}],"ironic/tests/api/test_types.py":[{"author":{"_account_id":8968,"name":"Max Lobur","email":"max_lobur@outlook.com","username":"max_lobur"},"change_message_id":"42d8e2dc2e0d78587dd81d3d8cbd55ee452bf71a","unresolved":false,"context_lines":[{"line_number":30,"context_line":"        test_mac \u003d \u0027aa:bb:cc:11:22:33\u0027"},{"line_number":31,"context_line":"        with mock.patch.object(utils, \u0027validate_and_normalize_mac\u0027) as m_mock:"},{"line_number":32,"context_line":"            types.MacAddressType.validate(test_mac)"},{"line_number":33,"context_line":"            m_mock.assert_called_once_with(test_mac)"},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"    def test_invalid_mac_addr(self):"},{"line_number":36,"context_line":"        self.assertRaises(exception.InvalidMAC,"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F9jTE%3D","line":33,"updated":"2013-12-10 10:46:02.000000000","message":"I\u0027d also suggest to set m_mock.return_value \u003d True and verify that MacAddressType.validate returns it without change - e.g. doesn\u0027t performs some additional actions.","commit_id":"da43a1f0dd0fc7e51eed5f50a2670bf894585101"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"5ee96d3edc35f1f035f1710ea98768dba22d00e9","unresolved":false,"context_lines":[{"line_number":30,"context_line":"        test_mac \u003d \u0027aa:bb:cc:11:22:33\u0027"},{"line_number":31,"context_line":"        with mock.patch.object(utils, \u0027validate_and_normalize_mac\u0027) as m_mock:"},{"line_number":32,"context_line":"            types.MacAddressType.validate(test_mac)"},{"line_number":33,"context_line":"            m_mock.assert_called_once_with(test_mac)"},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"    def test_invalid_mac_addr(self):"},{"line_number":36,"context_line":"        self.assertRaises(exception.InvalidMAC,"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F9Wuo%3D","line":33,"in_reply_to":"AAAATn%2F9jTE%3D","updated":"2013-12-12 10:42:36.000000000","message":"Right, you mean to mock the is_valid_mac() and return True, not the validate_and_normalize_mac(), right? If so I think that makes sense. But, I  think it be done in the test_utils.py tho\n\nThanks for the suggestion :)","commit_id":"da43a1f0dd0fc7e51eed5f50a2670bf894585101"}],"ironic/tests/test_utils.py":[{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"5d669c8fbcc0b104db4dbf0b55b2e6209e137633","unresolved":false,"context_lines":[{"line_number":313,"context_line":"        mac \u003d \u0027invalid-mac-format\u0027"},{"line_number":314,"context_line":"        self.assertRaises(exception.InvalidMAC,"},{"line_number":315,"context_line":"                          utils.validate_and_normalize_mac, mac)"},{"line_number":316,"context_line":""},{"line_number":317,"context_line":"    def test_safe_rstrip(self):"},{"line_number":318,"context_line":"        value \u003d \u0027/test/\u0027"},{"line_number":319,"context_line":"        rstripped_value \u003d \u0027/test\u0027"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F9Z4Y%3D","line":316,"updated":"2013-12-11 21:24:54.000000000","message":"How about testing a string with 5 or 7 octets? eg \"aa:bb:cc:11:22\"","commit_id":"da43a1f0dd0fc7e51eed5f50a2670bf894585101"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"5ee96d3edc35f1f035f1710ea98768dba22d00e9","unresolved":false,"context_lines":[{"line_number":313,"context_line":"        mac \u003d \u0027invalid-mac-format\u0027"},{"line_number":314,"context_line":"        self.assertRaises(exception.InvalidMAC,"},{"line_number":315,"context_line":"                          utils.validate_and_normalize_mac, mac)"},{"line_number":316,"context_line":""},{"line_number":317,"context_line":"    def test_safe_rstrip(self):"},{"line_number":318,"context_line":"        value \u003d \u0027/test/\u0027"},{"line_number":319,"context_line":"        rstripped_value \u003d \u0027/test\u0027"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F9WvI%3D","line":316,"in_reply_to":"AAAATn%2F9Z4Y%3D","updated":"2013-12-12 10:42:36.000000000","message":"Hi Ruby,\n\nThese values should be tested by the is_valid_mac() function and not duplicated here. The validate_and_normalize_mac() just use the is_valid_mac().\n\nThe validate_and_normalize_mac() has two outputs: In case the mac is valid it will return the mac normalized or if it\u0027s invalid it should raise InvalidMac. I think these two tests are already cover the scope of the validate_and_normalize_mac() function. As max suggested on the test_types.py file, I think I should even mock the is_valid_mac() to return what I want on each test to avoid any external dependencies.\n\nThanks for the suggestion anyway :)","commit_id":"da43a1f0dd0fc7e51eed5f50a2670bf894585101"}]}
