Read-only mode docs and unit tests for decorator and redirection
Review Request #8847 — Created March 26, 2017 and submitted
Read-only mode is a setting an admin can enable to prevent writes to
the database. This can be used when the site is under maintenence or
being upgraded. This commit adds some new documentation on how
extension authors can utilize read-only mode in js and django.
This commit also includes unit testing for the wrapped login_required
decorator and its usage to redirect New Review Request and My
Account when in read-only mode.
Build docs - no problem
Run python tests - pass except a couple that will be fixed in next commit
Description | From | Last Updated |
---|---|---|
"recommended that you enable read-only mode" |
|
|
"enabling read-only mode" instead of "putting the site in read-only mode" |
|
|
into. No comma here. |
|
|
"Review Board" |
|
|
The code should be aligned with the c in code-block, i.e., three spaces (yes, I know it's weird). |
|
|
"into" |
|
|
Just "API requests". |
|
|
How about "When the site is in read-only mode, only changes made to models by superusers will be propagated to … |
|
|
How about "When the site is in read-only mode, only changes made to models by superusers will be propagated to … |
|
|
Wrap readOnly in double-backtickcs so that gets marked as <code>. |
|
|
Likewise here. |
|
|
In JavaScript, this would actually be: if (conditional) { /* Comment */ } The code here also doesnt fit the … |
|
|
Undo this. |
|
|
We don't require docstrings for setUp, tearDown, etc. |
|
|
This can be moved into setUpClass, which only runs once per class, e.g. @classmethod def setUpClass(cls): super(LoginRequiredTest, cls).setUpClass() # ... |
|
|
This should be _mock_view_function. Also your args are in the wrong order. |
|
|
Care to split this up into user & super-user tests? |
|
|
Instead of "the decorator", say Testing @login_required. Same goes for all the tests here. No trailing periods in test docstrings. |
|
|
This comment is |
|
|
Care to split this up into user & super-user tests? |
|
|
Care to split this up into user & super-user tests? |
|
|
""" should be on next line. |
|
|
redefinition of unused 'test_my_account_does_not_redirect_when_not_read_only' from line 647 |
![]() |
|
This should be a phrase in the imperative mode, e.g. """Check response versus the expected value""" Missing args etc |
|
|
Can you split this into new tests? |
|
-
-
-
-
-
-
-
-
-
How about
"When the site is in read-only mode, only changes made to models by superusers will be propagated to the server; changes made by all other users will be discarded."
-
How about
"When the site is in read-only mode, only changes made to models by superusers will be propagated to the server; changes made by all other users will be discarded."
-
-
-
In JavaScript, this would actually be:
if (conditional) { /* Comment */ }
The code here also doesnt fit the above.
-
-
-
This can be moved into
setUpClass
, which only runs once per class, e.g.@classmethod def setUpClass(cls): super(LoginRequiredTest, cls).setUpClass() # ...
-
-
-
Instead of "the decorator", say
Testing @login_required
. Same goes for all the tests here.No trailing periods in test docstrings.
-
-
-
-
-
This should be a phrase in the imperative mode, e.g.
"""Check response versus the expected value"""
Missing args etc
-
- Summary:
-
[WIP] Read-only mode docs and unit testsRead-only mode docs and unit tests for decorator
- Description:
-
~ WIP for read-only mode.
~ ~ Adding some documentation and unit tests for decorator and redirections.
~ Read-only mode is a setting an admin can enable to prevent writes to
~ the database. This can be used when the site is under maintenence or ~ being upgraded. This commit adds some new documentation on how + extension authors can utilize read-only mode in js and django. + This commit also includes unit testing for the wrapped login_required + decorator. - Testing Done:
-
+ Build docs - no problem
+ Run python tests - pass except a couple that will be fixed in next commit - Depends On:
-
- Summary:
-
Read-only mode docs and unit tests for decoratorRead-only mode docs and unit tests for decorator and redirection
- Description:
-
Read-only mode is a setting an admin can enable to prevent writes to
the database. This can be used when the site is under maintenence or being upgraded. This commit adds some new documentation on how extension authors can utilize read-only mode in js and django. This commit also includes unit testing for the wrapped login_required ~ decorator. ~ decorator and its usage to redirect New Review Request and My + Account when in read-only mode.
- Change Summary:
-
Reponse to comments
- Diff:
-
Revision 2 (+275 -4)