)]}'
{"patrole_tempest_plugin/rbac_rule_validation.py":[{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"ad2898c151d87e205a36d3dd0d6c2fd06e984d91","unresolved":false,"context_lines":[{"line_number":84,"context_line":"    if expected_error_code \u003d\u003d 403:"},{"line_number":85,"context_line":"        expected_exception \u003d exceptions.Forbidden"},{"line_number":86,"context_line":"        irregular_msg \u003d None"},{"line_number":87,"context_line":"    if expected_error_code \u003d\u003d 404:"},{"line_number":88,"context_line":"        expected_exception \u003d exceptions.NotFound"},{"line_number":89,"context_line":"        irregular_msg \u003d (\"NotFound exception caught in {0}. \""},{"line_number":90,"context_line":"                         \"Exception is thrown when role doesn\u0027t have \""}],"source_content_type":"text/x-python","patch_set":4,"id":"3a1ff146_307376b3","line":87,"range":{"start_line":87,"start_character":4,"end_line":87,"end_character":6},"updated":"2017-03-14 23:55:01.000000000","message":"elif","commit_id":"cd44e175962e691a4c775eb318c93a0f3966c5d0"},{"author":{"_account_id":17896,"name":"Rick Bartra","email":"rickbartra@microsoft.com","username":"rb560u"},"change_message_id":"67c7ddd2998310330eed94bff949742943bdea9b","unresolved":false,"context_lines":[{"line_number":84,"context_line":"    if expected_error_code \u003d\u003d 403:"},{"line_number":85,"context_line":"        expected_exception \u003d exceptions.Forbidden"},{"line_number":86,"context_line":"        irregular_msg \u003d None"},{"line_number":87,"context_line":"    if expected_error_code \u003d\u003d 404:"},{"line_number":88,"context_line":"        expected_exception \u003d exceptions.NotFound"},{"line_number":89,"context_line":"        irregular_msg \u003d (\"NotFound exception caught in {0}. \""},{"line_number":90,"context_line":"                         \"Exception is thrown when role doesn\u0027t have \""}],"source_content_type":"text/x-python","patch_set":4,"id":"3a1ff146_0149af31","line":87,"range":{"start_line":87,"start_character":4,"end_line":87,"end_character":6},"in_reply_to":"3a1ff146_307376b3","updated":"2017-03-15 18:30:56.000000000","message":"fixed in next patch","commit_id":"cd44e175962e691a4c775eb318c93a0f3966c5d0"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"f6b1fe92f31f1663481a8479e9133d1acead46d9","unresolved":false,"context_lines":[{"line_number":86,"context_line":"        irregular_msg \u003d None"},{"line_number":87,"context_line":"    if expected_error_code \u003d\u003d 404:"},{"line_number":88,"context_line":"        expected_exception \u003d exceptions.NotFound"},{"line_number":89,"context_line":"        irregular_msg \u003d (\"NotFound exception caught in {0}. \""},{"line_number":90,"context_line":"                         \"Exception is thrown when role doesn\u0027t have \""},{"line_number":91,"context_line":"                         \"access to the endpoint for {1}.\")"},{"line_number":92,"context_line":"    if not isinstance(expected_error_code, int):"},{"line_number":93,"context_line":"        msg \u003d (\"Please pass a valid integer for the expected error code\")"},{"line_number":94,"context_line":"        LOG.error(msg)"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a1ff146_b09046ee","line":91,"range":{"start_line":89,"start_character":24,"end_line":91,"end_character":59},"updated":"2017-03-15 00:00:36.000000000","message":"Can we say something like \"NotFound exception was caught for policy action {0}. The service {1} throws a {2} instead of a 403, which is irregular.\".format(rule, service, expected_exception)","commit_id":"cd44e175962e691a4c775eb318c93a0f3966c5d0"},{"author":{"_account_id":17896,"name":"Rick Bartra","email":"rickbartra@microsoft.com","username":"rb560u"},"change_message_id":"67c7ddd2998310330eed94bff949742943bdea9b","unresolved":false,"context_lines":[{"line_number":86,"context_line":"        irregular_msg \u003d None"},{"line_number":87,"context_line":"    if expected_error_code \u003d\u003d 404:"},{"line_number":88,"context_line":"        expected_exception \u003d exceptions.NotFound"},{"line_number":89,"context_line":"        irregular_msg \u003d (\"NotFound exception caught in {0}. \""},{"line_number":90,"context_line":"                         \"Exception is thrown when role doesn\u0027t have \""},{"line_number":91,"context_line":"                         \"access to the endpoint for {1}.\")"},{"line_number":92,"context_line":"    if not isinstance(expected_error_code, int):"},{"line_number":93,"context_line":"        msg \u003d (\"Please pass a valid integer for the expected error code\")"},{"line_number":94,"context_line":"        LOG.error(msg)"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a1ff146_a158dbfb","line":91,"range":{"start_line":89,"start_character":24,"end_line":91,"end_character":59},"in_reply_to":"3a1ff146_b09046ee","updated":"2017-03-15 18:30:56.000000000","message":"fixed in next patch","commit_id":"cd44e175962e691a4c775eb318c93a0f3966c5d0"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"ad2898c151d87e205a36d3dd0d6c2fd06e984d91","unresolved":false,"context_lines":[{"line_number":89,"context_line":"        irregular_msg \u003d (\"NotFound exception caught in {0}. \""},{"line_number":90,"context_line":"                         \"Exception is thrown when role doesn\u0027t have \""},{"line_number":91,"context_line":"                         \"access to the endpoint for {1}.\")"},{"line_number":92,"context_line":"    if not isinstance(expected_error_code, int):"},{"line_number":93,"context_line":"        msg \u003d (\"Please pass a valid integer for the expected error code\")"},{"line_number":94,"context_line":"        LOG.error(msg)"},{"line_number":95,"context_line":"        raise rbac_exceptions.RbacInvalidErrorCode()"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a1ff146_90626ad7","line":92,"range":{"start_line":92,"start_character":4,"end_line":92,"end_character":48},"updated":"2017-03-14 23:55:01.000000000","message":"else:","commit_id":"cd44e175962e691a4c775eb318c93a0f3966c5d0"},{"author":{"_account_id":17896,"name":"Rick Bartra","email":"rickbartra@microsoft.com","username":"rb560u"},"change_message_id":"67c7ddd2998310330eed94bff949742943bdea9b","unresolved":false,"context_lines":[{"line_number":89,"context_line":"        irregular_msg \u003d (\"NotFound exception caught in {0}. \""},{"line_number":90,"context_line":"                         \"Exception is thrown when role doesn\u0027t have \""},{"line_number":91,"context_line":"                         \"access to the endpoint for {1}.\")"},{"line_number":92,"context_line":"    if not isinstance(expected_error_code, int):"},{"line_number":93,"context_line":"        msg \u003d (\"Please pass a valid integer for the expected error code\")"},{"line_number":94,"context_line":"        LOG.error(msg)"},{"line_number":95,"context_line":"        raise rbac_exceptions.RbacInvalidErrorCode()"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a1ff146_0170cf71","line":92,"range":{"start_line":92,"start_character":4,"end_line":92,"end_character":48},"in_reply_to":"3a1ff146_90626ad7","updated":"2017-03-15 18:30:56.000000000","message":"fixed in next patch","commit_id":"cd44e175962e691a4c775eb318c93a0f3966c5d0"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"ad2898c151d87e205a36d3dd0d6c2fd06e984d91","unresolved":false,"context_lines":[{"line_number":90,"context_line":"                         \"Exception is thrown when role doesn\u0027t have \""},{"line_number":91,"context_line":"                         \"access to the endpoint for {1}.\")"},{"line_number":92,"context_line":"    if not isinstance(expected_error_code, int):"},{"line_number":93,"context_line":"        msg \u003d (\"Please pass a valid integer for the expected error code\")"},{"line_number":94,"context_line":"        LOG.error(msg)"},{"line_number":95,"context_line":"        raise rbac_exceptions.RbacInvalidErrorCode()"},{"line_number":96,"context_line":""},{"line_number":97,"context_line":"    return expected_exception, irregular_msg"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a1ff146_10411a0c","line":95,"range":{"start_line":93,"start_character":0,"end_line":95,"end_character":52},"updated":"2017-03-14 23:55:01.000000000","message":"There\u0027s 2 ways we can do this.\n1) Either we can only accept 403/404 in which case you can just raise RbacInvalidErrorCode immediately.\n\n2) Check whether int value is a valid http code. For example:\n\nif expected_error_code not in [httplib2.httplib.NOT_FOUND, httplib2.httlib.FORBIDDEN]:\n    raise ...\n\n(httplib2 is in global-requirements: https://github.com/openstack/requirements/blob/master/global-requirements.txt)\n\nBut the problem with 2) is that if you pass in expected_error_code \u003d 200 is that a) that\u0027s not even an error code and b) you\u0027ll end up returning None, so then you\u0027ll just try to catch None -- and that\u0027ll probably error out?","commit_id":"cd44e175962e691a4c775eb318c93a0f3966c5d0"},{"author":{"_account_id":17896,"name":"Rick Bartra","email":"rickbartra@microsoft.com","username":"rb560u"},"change_message_id":"67c7ddd2998310330eed94bff949742943bdea9b","unresolved":false,"context_lines":[{"line_number":90,"context_line":"                         \"Exception is thrown when role doesn\u0027t have \""},{"line_number":91,"context_line":"                         \"access to the endpoint for {1}.\")"},{"line_number":92,"context_line":"    if not isinstance(expected_error_code, int):"},{"line_number":93,"context_line":"        msg \u003d (\"Please pass a valid integer for the expected error code\")"},{"line_number":94,"context_line":"        LOG.error(msg)"},{"line_number":95,"context_line":"        raise rbac_exceptions.RbacInvalidErrorCode()"},{"line_number":96,"context_line":""},{"line_number":97,"context_line":"    return expected_exception, irregular_msg"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a1ff146_6188a323","line":95,"range":{"start_line":93,"start_character":0,"end_line":95,"end_character":52},"in_reply_to":"3a1ff146_10411a0c","updated":"2017-03-15 18:30:56.000000000","message":"I will go with option 1. If in the future, we expect some other error code besides 403 or 404, we will have to map it to specific exception in the _get_exception_type method. So for example, if in the future we expect 500 we will need to map it to Internal Server Error, and in the else statement we will only accept 403, 404, and 500. Any other response code will raise RbacInvalidErrorCode.","commit_id":"cd44e175962e691a4c775eb318c93a0f3966c5d0"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"0efe2e451a41944a9e9c69196554d6c33b3b83eb","unresolved":false,"context_lines":[{"line_number":92,"context_line":"    supported_error_codes \u003d [403, 404]"},{"line_number":93,"context_line":"    if expected_error_code \u003d\u003d 403:"},{"line_number":94,"context_line":"        expected_exception \u003d exceptions.Forbidden"},{"line_number":95,"context_line":"        irregular_msg \u003d None"},{"line_number":96,"context_line":"    elif expected_error_code \u003d\u003d 404:"},{"line_number":97,"context_line":"        expected_exception \u003d exceptions.NotFound"},{"line_number":98,"context_line":"        irregular_msg \u003d (\"NotFound exception was caught for policy action \""}],"source_content_type":"text/x-python","patch_set":13,"id":"3a1ff146_672a612e","line":95,"range":{"start_line":95,"start_character":8,"end_line":95,"end_character":28},"updated":"2017-03-15 23:59:58.000000000","message":"nit: Not needed, already None","commit_id":"1941ef8a5ae5492976b280e4c7ec345947aeb89a"},{"author":{"_account_id":17896,"name":"Rick Bartra","email":"rickbartra@microsoft.com","username":"rb560u"},"change_message_id":"35200873ed2254bdd3cb662a35bb67a6bd44933f","unresolved":false,"context_lines":[{"line_number":92,"context_line":"    supported_error_codes \u003d [403, 404]"},{"line_number":93,"context_line":"    if expected_error_code \u003d\u003d 403:"},{"line_number":94,"context_line":"        expected_exception \u003d exceptions.Forbidden"},{"line_number":95,"context_line":"        irregular_msg \u003d None"},{"line_number":96,"context_line":"    elif expected_error_code \u003d\u003d 404:"},{"line_number":97,"context_line":"        expected_exception \u003d exceptions.NotFound"},{"line_number":98,"context_line":"        irregular_msg \u003d (\"NotFound exception was caught for policy action \""}],"source_content_type":"text/x-python","patch_set":13,"id":"3a1ff146_44e9ca13","line":95,"range":{"start_line":95,"start_character":8,"end_line":95,"end_character":28},"in_reply_to":"3a1ff146_672a612e","updated":"2017-03-16 14:06:27.000000000","message":"fixed in next patch","commit_id":"1941ef8a5ae5492976b280e4c7ec345947aeb89a"}],"patrole_tempest_plugin/tests/unit/test_rbac_rule_validation.py":[{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"ad2898c151d87e205a36d3dd0d6c2fd06e984d91","unresolved":false,"context_lines":[{"line_number":47,"context_line":"        self.assertRaises(exceptions.Forbidden, wrapper, mock_args)"},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"    @mock.patch(\u0027patrole_tempest_plugin.rbac_auth.RbacAuthority\u0027)"},{"line_number":50,"context_line":"    def test_RBAC_rv_notfound(self, mock_auth):"},{"line_number":51,"context_line":"        decorator \u003d rbac_rv.action(\"\", \"\", 404)"},{"line_number":52,"context_line":"        mock_function \u003d mock.Mock()"},{"line_number":53,"context_line":"        mock_function.side_effect \u003d exceptions.NotFound"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a1ff146_100cba93","line":50,"range":{"start_line":50,"start_character":8,"end_line":50,"end_character":29},"updated":"2017-03-14 23:55:01.000000000","message":"Can we call this:\n\ntest_expect_not_found_but_raises_forbidden\n\nI\u0027m assuming you\u0027re trying to make this expect a 404, but instead use side_effect to throw a 403?","commit_id":"cd44e175962e691a4c775eb318c93a0f3966c5d0"},{"author":{"_account_id":17896,"name":"Rick Bartra","email":"rickbartra@microsoft.com","username":"rb560u"},"change_message_id":"67c7ddd2998310330eed94bff949742943bdea9b","unresolved":false,"context_lines":[{"line_number":47,"context_line":"        self.assertRaises(exceptions.Forbidden, wrapper, mock_args)"},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"    @mock.patch(\u0027patrole_tempest_plugin.rbac_auth.RbacAuthority\u0027)"},{"line_number":50,"context_line":"    def test_RBAC_rv_notfound(self, mock_auth):"},{"line_number":51,"context_line":"        decorator \u003d rbac_rv.action(\"\", \"\", 404)"},{"line_number":52,"context_line":"        mock_function \u003d mock.Mock()"},{"line_number":53,"context_line":"        mock_function.side_effect \u003d exceptions.NotFound"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a1ff146_a458e9fb","line":50,"range":{"start_line":50,"start_character":8,"end_line":50,"end_character":29},"in_reply_to":"3a1ff146_100cba93","updated":"2017-03-15 18:30:56.000000000","message":"fixed in next patch","commit_id":"cd44e175962e691a4c775eb318c93a0f3966c5d0"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"ad2898c151d87e205a36d3dd0d6c2fd06e984d91","unresolved":false,"context_lines":[{"line_number":50,"context_line":"    def test_RBAC_rv_notfound(self, mock_auth):"},{"line_number":51,"context_line":"        decorator \u003d rbac_rv.action(\"\", \"\", 404)"},{"line_number":52,"context_line":"        mock_function \u003d mock.Mock()"},{"line_number":53,"context_line":"        mock_function.side_effect \u003d exceptions.NotFound"},{"line_number":54,"context_line":"        wrapper \u003d decorator(mock_function)"},{"line_number":55,"context_line":"        mock_args \u003d mock.MagicMock(**{"},{"line_number":56,"context_line":"            \u0027auth_provider.credentials.tenant_id\u0027: \u0027tenant_id\u0027"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a1ff146_10359a45","line":53,"range":{"start_line":53,"start_character":47,"end_line":53,"end_character":55},"updated":"2017-03-14 23:55:01.000000000","message":"Is this supposed to be Forbbiden?","commit_id":"cd44e175962e691a4c775eb318c93a0f3966c5d0"},{"author":{"_account_id":17896,"name":"Rick Bartra","email":"rickbartra@microsoft.com","username":"rb560u"},"change_message_id":"67c7ddd2998310330eed94bff949742943bdea9b","unresolved":false,"context_lines":[{"line_number":50,"context_line":"    def test_RBAC_rv_notfound(self, mock_auth):"},{"line_number":51,"context_line":"        decorator \u003d rbac_rv.action(\"\", \"\", 404)"},{"line_number":52,"context_line":"        mock_function \u003d mock.Mock()"},{"line_number":53,"context_line":"        mock_function.side_effect \u003d exceptions.NotFound"},{"line_number":54,"context_line":"        wrapper \u003d decorator(mock_function)"},{"line_number":55,"context_line":"        mock_args \u003d mock.MagicMock(**{"},{"line_number":56,"context_line":"            \u0027auth_provider.credentials.tenant_id\u0027: \u0027tenant_id\u0027"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a1ff146_04a1bd94","line":53,"range":{"start_line":53,"start_character":47,"end_line":53,"end_character":55},"in_reply_to":"3a1ff146_10359a45","updated":"2017-03-15 18:30:56.000000000","message":"refer to test: test_RBAC_rv_rbac_action_failed","commit_id":"cd44e175962e691a4c775eb318c93a0f3966c5d0"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"ad2898c151d87e205a36d3dd0d6c2fd06e984d91","unresolved":false,"context_lines":[{"line_number":106,"context_line":"        self.assertIsNone(wrapper(mock_args))"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"    @mock.patch(\u0027patrole_tempest_plugin.rbac_auth.RbacAuthority\u0027)"},{"line_number":109,"context_line":"    def test_RBAC_rv_notfound_not_allowed(self, mock_auth):"},{"line_number":110,"context_line":"        decorator \u003d rbac_rv.action(\"\", \"\", 404)"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"        mock_function \u003d mock.Mock()"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a1ff146_d07862fb","line":109,"range":{"start_line":109,"start_character":8,"end_line":109,"end_character":41},"updated":"2017-03-14 23:55:01.000000000","message":"Can we call this:\n\ntest_expect_not_found_and_raises_not_found","commit_id":"cd44e175962e691a4c775eb318c93a0f3966c5d0"},{"author":{"_account_id":17896,"name":"Rick Bartra","email":"rickbartra@microsoft.com","username":"rb560u"},"change_message_id":"67c7ddd2998310330eed94bff949742943bdea9b","unresolved":false,"context_lines":[{"line_number":106,"context_line":"        self.assertIsNone(wrapper(mock_args))"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"    @mock.patch(\u0027patrole_tempest_plugin.rbac_auth.RbacAuthority\u0027)"},{"line_number":109,"context_line":"    def test_RBAC_rv_notfound_not_allowed(self, mock_auth):"},{"line_number":110,"context_line":"        decorator \u003d rbac_rv.action(\"\", \"\", 404)"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"        mock_function \u003d mock.Mock()"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a1ff146_44749534","line":109,"range":{"start_line":109,"start_character":8,"end_line":109,"end_character":41},"in_reply_to":"3a1ff146_d07862fb","updated":"2017-03-15 18:30:56.000000000","message":"it does not raise not found, so I don\u0027t think the name should be that","commit_id":"cd44e175962e691a4c775eb318c93a0f3966c5d0"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"3a5083a0749ad44ab8bb25a62fb9c7c8e7c6483b","unresolved":false,"context_lines":[{"line_number":30,"context_line":"        self.mock_args.auth_provider \u003d mock.Mock()"},{"line_number":31,"context_line":"        self.mock_args.rbac_utils \u003d mock.Mock()"},{"line_number":32,"context_line":"        self.mock_args.auth_provider.credentials.tenant_id \u003d \u0027tenant_id\u0027"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"    @mock.patch(\u0027patrole_tempest_plugin.rbac_auth.RbacAuthority\u0027)"},{"line_number":35,"context_line":"    def test_RBAC_rv_happy_path(self, mock_auth):"},{"line_number":36,"context_line":"        decorator \u003d rbac_rv.action(\"\", \"\")"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a1ced50_18ceb183","line":33,"updated":"2017-03-16 18:58:31.000000000","message":"CONF.set_override(\u0027rbac_test_role\u0027, \u0027fake_role\u0027, group\u003d\u0027rbac\u0027, enforce_type\u003dTrue)\nself.addCleanup(CONF.clear_override, \u0027rbac_test_role\u0027, group\u003d\u0027rbac\u0027)","commit_id":"3de0105081e3a146f4c872af361c33f9406ec4c2"},{"author":{"_account_id":17896,"name":"Rick Bartra","email":"rickbartra@microsoft.com","username":"rb560u"},"change_message_id":"2ab6dec135f521a68cc185ee2b3d48d948bdbe18","unresolved":false,"context_lines":[{"line_number":30,"context_line":"        self.mock_args.auth_provider \u003d mock.Mock()"},{"line_number":31,"context_line":"        self.mock_args.rbac_utils \u003d mock.Mock()"},{"line_number":32,"context_line":"        self.mock_args.auth_provider.credentials.tenant_id \u003d \u0027tenant_id\u0027"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"    @mock.patch(\u0027patrole_tempest_plugin.rbac_auth.RbacAuthority\u0027)"},{"line_number":35,"context_line":"    def test_RBAC_rv_happy_path(self, mock_auth):"},{"line_number":36,"context_line":"        decorator \u003d rbac_rv.action(\"\", \"\")"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a1ced50_1aee808b","line":33,"in_reply_to":"1a1ced50_18ceb183","updated":"2017-03-17 21:28:24.000000000","message":"done in next patch","commit_id":"3de0105081e3a146f4c872af361c33f9406ec4c2"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"3a5083a0749ad44ab8bb25a62fb9c7c8e7c6483b","unresolved":false,"context_lines":[{"line_number":56,"context_line":"        mock_function.side_effect \u003d exceptions.NotFound"},{"line_number":57,"context_line":"        wrapper \u003d decorator(mock_function)"},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"        self.assertRaises(exceptions.Forbidden, wrapper, self.mock_args)"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    @mock.patch(\u0027patrole_tempest_plugin.rbac_auth.RbacAuthority\u0027)"},{"line_number":62,"context_line":"    def test_RBAC_rv_rbac_action_failed(self, mock_auth):"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a1ced50_b8a59db6","line":59,"range":{"start_line":59,"start_character":8,"end_line":59,"end_character":12},"updated":"2017-03-16 18:58:31.000000000","message":"e \u003d self....","commit_id":"3de0105081e3a146f4c872af361c33f9406ec4c2"},{"author":{"_account_id":17896,"name":"Rick Bartra","email":"rickbartra@microsoft.com","username":"rb560u"},"change_message_id":"2ab6dec135f521a68cc185ee2b3d48d948bdbe18","unresolved":false,"context_lines":[{"line_number":56,"context_line":"        mock_function.side_effect \u003d exceptions.NotFound"},{"line_number":57,"context_line":"        wrapper \u003d decorator(mock_function)"},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"        self.assertRaises(exceptions.Forbidden, wrapper, self.mock_args)"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    @mock.patch(\u0027patrole_tempest_plugin.rbac_auth.RbacAuthority\u0027)"},{"line_number":62,"context_line":"    def test_RBAC_rv_rbac_action_failed(self, mock_auth):"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a1ced50_d51afb16","line":59,"range":{"start_line":59,"start_character":8,"end_line":59,"end_character":12},"in_reply_to":"1a1ced50_b8a59db6","updated":"2017-03-17 21:28:24.000000000","message":"fixed in next patch","commit_id":"3de0105081e3a146f4c872af361c33f9406ec4c2"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"3a5083a0749ad44ab8bb25a62fb9c7c8e7c6483b","unresolved":false,"context_lines":[{"line_number":57,"context_line":"        wrapper \u003d decorator(mock_function)"},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"        self.assertRaises(exceptions.Forbidden, wrapper, self.mock_args)"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    @mock.patch(\u0027patrole_tempest_plugin.rbac_auth.RbacAuthority\u0027)"},{"line_number":62,"context_line":"    def test_RBAC_rv_rbac_action_failed(self, mock_auth):"},{"line_number":63,"context_line":"        decorator \u003d rbac_rv.action(\"\", \"\")"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a1ced50_18a311a0","line":60,"updated":"2017-03-16 18:58:31.000000000","message":"Then: \n1) assert that str(e) is equal to the expected error message.\n2) assert that LOG.error was called with the expected error message (see below comments for more detail).","commit_id":"3de0105081e3a146f4c872af361c33f9406ec4c2"},{"author":{"_account_id":17896,"name":"Rick Bartra","email":"rickbartra@microsoft.com","username":"rb560u"},"change_message_id":"2ab6dec135f521a68cc185ee2b3d48d948bdbe18","unresolved":false,"context_lines":[{"line_number":57,"context_line":"        wrapper \u003d decorator(mock_function)"},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"        self.assertRaises(exceptions.Forbidden, wrapper, self.mock_args)"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    @mock.patch(\u0027patrole_tempest_plugin.rbac_auth.RbacAuthority\u0027)"},{"line_number":62,"context_line":"    def test_RBAC_rv_rbac_action_failed(self, mock_auth):"},{"line_number":63,"context_line":"        decorator \u003d rbac_rv.action(\"\", \"\")"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a1ced50_755f8772","line":60,"in_reply_to":"1a1ced50_18a311a0","updated":"2017-03-17 21:28:24.000000000","message":"done in next patch","commit_id":"3de0105081e3a146f4c872af361c33f9406ec4c2"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"3a5083a0749ad44ab8bb25a62fb9c7c8e7c6483b","unresolved":false,"context_lines":[{"line_number":94,"context_line":"        mock_auth.return_value \u003d mock_permission"},{"line_number":95,"context_line":""},{"line_number":96,"context_line":"        self.assertIsNone(wrapper(self.mock_args))"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"    @mock.patch(\u0027patrole_tempest_plugin.rbac_auth.RbacAuthority\u0027)"},{"line_number":99,"context_line":"    def test_expect_not_found_and_not_allowed(self, mock_auth):"},{"line_number":100,"context_line":"        decorator \u003d rbac_rv.action(\"\", \"\", 404)"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a1ced50_f85c75ef","line":97,"updated":"2017-03-16 18:58:31.000000000","message":"May we add this above the first decorator:\n\n@mock.patch.object(rbac_rv, \u0027LOG\u0027, autospec\u003dTrue)\n\nThen add mock_log after mock_auth in the args to the test function.","commit_id":"3de0105081e3a146f4c872af361c33f9406ec4c2"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"3a5083a0749ad44ab8bb25a62fb9c7c8e7c6483b","unresolved":false,"context_lines":[{"line_number":97,"context_line":""},{"line_number":98,"context_line":"    @mock.patch(\u0027patrole_tempest_plugin.rbac_auth.RbacAuthority\u0027)"},{"line_number":99,"context_line":"    def test_expect_not_found_and_not_allowed(self, mock_auth):"},{"line_number":100,"context_line":"        decorator \u003d rbac_rv.action(\"\", \"\", 404)"},{"line_number":101,"context_line":""},{"line_number":102,"context_line":"        mock_function \u003d mock.Mock()"},{"line_number":103,"context_line":"        mock_function.side_effect \u003d exceptions.NotFound"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a1ced50_381d2d10","line":100,"range":{"start_line":100,"start_character":35,"end_line":100,"end_character":41},"updated":"2017-03-16 18:58:31.000000000","message":"\"fake_service\", \"fake_rule\"","commit_id":"3de0105081e3a146f4c872af361c33f9406ec4c2"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"3a5083a0749ad44ab8bb25a62fb9c7c8e7c6483b","unresolved":false,"context_lines":[{"line_number":108,"context_line":"        mock_auth.return_value \u003d mock_permission"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"        self.assertIsNone(wrapper(self.mock_args))"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    @mock.patch(\u0027patrole_tempest_plugin.rbac_auth.RbacAuthority\u0027)"},{"line_number":113,"context_line":"    def test_RBAC_rv_rbac_action_failed_not_allowed(self, mock_auth):"},{"line_number":114,"context_line":"        decorator \u003d rbac_rv.action(\"\", \"\")"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a1ced50_38f60dd8","line":111,"updated":"2017-03-16 18:58:31.000000000","message":"Then we can assert mock_log.debug.assert_called_once_with(\u0027Role %s was allowed to perform %s\u0027 % (\u0027fake_role\u0027, \u0027fake_rule\u0027)","commit_id":"3de0105081e3a146f4c872af361c33f9406ec4c2"},{"author":{"_account_id":17896,"name":"Rick Bartra","email":"rickbartra@microsoft.com","username":"rb560u"},"change_message_id":"2ab6dec135f521a68cc185ee2b3d48d948bdbe18","unresolved":false,"context_lines":[{"line_number":108,"context_line":"        mock_auth.return_value \u003d mock_permission"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"        self.assertIsNone(wrapper(self.mock_args))"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    @mock.patch(\u0027patrole_tempest_plugin.rbac_auth.RbacAuthority\u0027)"},{"line_number":113,"context_line":"    def test_RBAC_rv_rbac_action_failed_not_allowed(self, mock_auth):"},{"line_number":114,"context_line":"        decorator \u003d rbac_rv.action(\"\", \"\")"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a1ced50_687969fc","line":111,"in_reply_to":"1a1ced50_38f60dd8","updated":"2017-03-17 21:28:24.000000000","message":"there is actually no logging from this scenario","commit_id":"3de0105081e3a146f4c872af361c33f9406ec4c2"},{"author":{"_account_id":23186,"name":"Felipe Monteiro","email":"felipe.carneiro.monteiro@gmail.com","username":"felipe.monteiro"},"change_message_id":"5c7879cce8845a4ade671fe9c9817b928c96a7c0","unresolved":false,"context_lines":[{"line_number":108,"context_line":"        mock_auth.return_value \u003d mock_permission"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"        self.assertIsNone(wrapper(self.mock_args))"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    @mock.patch(\u0027patrole_tempest_plugin.rbac_auth.RbacAuthority\u0027)"},{"line_number":113,"context_line":"    def test_RBAC_rv_rbac_action_failed_not_allowed(self, mock_auth):"},{"line_number":114,"context_line":"        decorator \u003d rbac_rv.action(\"\", \"\")"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a1ced50_8e4f8d91","line":111,"in_reply_to":"1a1ced50_687969fc","updated":"2017-03-17 22:58:22.000000000","message":"In that case you can just do mock_log.error.assert_not_called()\nmock_log.warning.assert_not_called()","commit_id":"3de0105081e3a146f4c872af361c33f9406ec4c2"}]}
