Sandboxed ReviewRequestApprovalHook and added test cases
Review Request #5677 — Created April 5, 2014 and submitted
Sandboxed ReviewRequestApprovalHook and added test cases
Added Sandbox Extension and test hook.
Unit testing, added to test suites in reviewboard/extensions/tests.py
Ran unit tests with and without the sandboxing
Description | From | Last Updated |
---|---|---|
We want two blank lines. You shouldn't alter lines unrelated to your change. |
chipx86 | |
This is missing a docstring. |
chipx86 | |
""" at the beginning. |
chipx86 | |
Missing a docstring. I don't understand the point of splitting this into two functions? |
chipx86 | |
This is defeating the purpose of the sandboxing work, since it's still crashing the program if there's an error. The … |
chipx86 | |
Please sort these in alphabetical order (errors before manager). |
david | |
Please keep the things that are imported in alphabetical order. |
david | |
I think you should subclass ReviewRequestApprovalHook and implement your own custom is_approved method (which raises some error), rather than relying … |
david | |
This logging statement should include the extension name/id, as well as the contents of the exception that was raised. |
david | |
We don't want to raise any errors here, we just want to log and continue with the other hooks. |
david | |
This should be updated now, since is_approved is implemented. |
david | |
The logging methods will format the string with any args that they get, so it's better to pass them in … |
david | |
This should be "ReviewRequestApprovalHook" |
david | |
The "throws an error" should be aligned with """ and not "Testing" |
chipx86 |
- Description:
-
Sandboxed ReviewRequestApprovalHook and added test cases
- - I want to make sure I'm on the right path and if I added my test cases/everything correctly
- Groups:
-
-
-
-
I think you should subclass ReviewRequestApprovalHook and implement your own custom is_approved method (which raises some error), rather than relying on the fact that the default implementation currently raises NotImplementedError.
ReviewRequestApprovalHook also does not take an
entries
parameter for its__init__
method, so you can just get rid of the whole entry part. -
This logging statement should include the extension name/id, as well as the contents of the exception that was raised.
-
- Description:
-
Sandboxed ReviewRequestApprovalHook and added test cases
+ + Added Sandbox Extension and test hook.
-
-
-
The logging methods will format the string with any args that they get, so it's better to pass them in as arguments instead of doing the format yourself (because then there will be two format operations). I'd also like to switch the format string around a bit--personally I think this is a little weird:
Error calling function is_approved: Permission Denide: MyExtension
Thus, this should look something like this:
logging.error('Error when running ReviewRequestApprovalHook.' 'is_approved in extension "%s": %s', extension.metadata['Name'], e, exc_info=1)
- Summary:
-
[WIP] Sandboxed ReviewRequestApprovalHook and added test casesSandboxed ReviewRequestApprovalHook and added test cases
- Testing Done:
-
+ Unit testing, added to test suites in reviewboard/extensions.py
- Testing Done:
-
Unit testing, added to test suites in reviewboard/extensions.py
+ + Ran unit tests with and without the sandboxing