Replace old selectors with smart objects selector widget in the administration UI
Review Request #10215 — Created Oct. 10, 2018 and submitted
Now that
RelatedObjectedWidget
is in Djblets, we import
it from there and extend it in theRelatedUserWidget
.Created
RelatedRepositoryWidget
andRelatedGroupWidget
, along with
relevant HTML and JS files, which extends theRelatedObjectsWidget
.
RelatedGroupWidget
has the ability to only display groups that are
invite only. All three widgets, for exampe, can be viewed on
/admin/db/reviews/defaultreviewer/add/
, and they all function.See /r/10214.
Created
relatedUserSelectorTests.es6.js
,
relatedRepoSelectorTests.es6.js
, and
relatedGroupSelectorTests.es6.js
to test the widgets
javascript functionality.Ran
./tests/runtests.py
and no errors were thrown. Ran the js-tests, and
no errors were thrown.New unit tests were created in
reviewboard.admin.tests
that test
the functionality of the widgets. The test classes are:
RelatedUserWidgetTestCase
,RelatedRepositoryWidgetTestCase
and,
RelatedGroupWidgetTestCase
.Navigated to
/admin/db/reviews/defaultreviewer/add/
and the
RelatedUserWidget
,RelatedRepositoryWidget
and
RelatedGroupWidget
function as intended.
Description | From | Last Updated |
---|---|---|
Instead of "See patch #10214" you can do: See /r/10214/. and it will be linked correctly. (e.g. /r/10214/) |
brennie | |
You also need to migrate the template. |
brennie | |
Can you show before/after screenshots of each usage? |
chipx86 | |
These tests does not actually test rendering at all, even though they . If it is testing rendering, I would … |
brennie | |
In your description it says: Moved RelatedObjectWidget into Djblets. This patch doesn't actually do that (since it doesn't affect Djblets.) … |
brennie | |
This doesn't need to live on the prototype. It can live as a global (const searchPlaceholderText = ...) since you're … |
brennie | |
Col: 37 Missing semicolon. |
reviewbot | |
Col: 41 Expected '===' and instead saw '=='. |
reviewbot | |
I was wondering why you removed the init method. do you instantiate the local_site_name and multivalued variables else where? or … |
praiseA | |
Col: 42 Missing semicolon. |
reviewbot | |
Col: 3 Missing semicolon. |
reviewbot | |
Initalize->Initialize Typo. |
cdkushni | |
Did this work for you? I found that when running tests, pdb would interrupt control flow but I wouldn't be … |
cdkushni | |
These should be in the same import group. |
chipx86 | |
These should be in alphabetical order. |
chipx86 | |
who's already in the list I think this was left over from copy & paste, as it should say: which … |
brennie | |
No nee for the or None part. None is a value. |
chipx86 | |
This can easily be: repo_data = [ { 'id': repo.pk, 'name': repo.name, } for repo in self.existing_repos ] |
chipx86 | |
It'd be better to have the template take the HTML for the input element and have it take care of … |
chipx86 | |
Can you instead do: The list of IDs of :py:class:`~reviewboard.scmtools.models.Repository` objects. Wrapping appropriately. (You can wrap at a . inside … |
chipx86 | |
"invite-only" |
chipx86 | |
Same comment as above. |
chipx86 | |
These should be in alphabetical order. |
chipx86 | |
There should be one class per widget we are testing. |
brennie | |
Since these aren't doing anything special, you can remove them. |
chipx86 | |
These aren't necessary |
brennie | |
These aren't necessary. |
brennie | |
No period, as unit tests are printed as: TEST_DOCSTRING ... OK Same for all other tests. |
brennie | |
Single quotes throughout the file. |
brennie | |
A better way to wrap would be: user_widget = \ response.context['adminform'].form.fields['user'].widget.widget Same with tests below. |
chipx86 | |
This can be one request, like: response = self.client.post( '.....', { ... }) Same with tests below. |
chipx86 | |
You definitely don't want to use str here. str means two differen things depending on your version of Python. On … |
brennie | |
This only works by accident. YOu should be retrieving the latest Application and using its pk here instead, e.g. application … |
brennie | |
Same here re: string types and primary keys. |
brennie | |
Single quotes. |
brennie | |
Same comment here about string types. test_repo.pk is not correct. This should be WebHookTarget.objects.latest().pk |
brennie | |
Again, this should use % formatting and this only works as a fluke that test_group.pk == DefaultReviewer.objects.latest().pk. (e.g., they're both … |
brennie | |
These should be in alphabetical order. |
chipx86 | |
These should be in alphabetical order. |
chipx86 | |
can you use a keyword argument for whatever True is? (Is it required=?). |
brennie | |
Can you make sure that the label is still appropriate? |
chipx86 | |
Two blank lines between these. |
chipx86 | |
This should only be indented one space relative to the line above. |
brennie | |
Two blank lines between these. |
chipx86 | |
The string needs to be wrapped with gettext(...). Does this need to be here? Why isn't it just being set … |
chipx86 | |
This should be called inviteOnly in JavaScript. |
chipx86 | |
This should be this._inviteOnly. |
brennie | |
This can just do return optionTemplate(item) since the template shouldn't be modifying the item. |
brennie | |
const if the variable is not being rebound, let otherwise. Also, this should be localInviteOnly. JS uses lowerCamelCase. |
brennie | |
This doesn't bother me, but another mentor is going to tell you to do succes: results => { ... } … |
brennie | |
this mapping function is happening twice, so we should pull it out into e.g. this._resultToItem or similar. However, if we … |
brennie | |
Here too. |
brennie | |
This should only be indented one space relative to the line above. |
brennie | |
"Local Site" |
chipx86 | |
Typo: "multuple" -> "multiple" |
chipx86 | |
No need for the _.extend, since there isn't a dictionary to extend. You should be able to just pass item. |
chipx86 | |
Not strictly necessary, but I imagine another mentor will tell you not to use shorthand object method syntax here. |
brennie | |
Not strictly necessary, but I imagine another mentor will tell you not to use shorthand object method syntax here. |
brennie | |
This is technically an API breakage. Any extensions pulling in widgets will now fail. I assume this is due to … |
chipx86 | |
djblets-widgets should be first. |
chipx86 | |
This can just be <script> these days. |
chipx86 | |
As above, this should be inviteOnly. |
chipx86 | |
This can just be <script> these days. |
chipx86 | |
I think these should be in aphabetical order |
bolariinwa | |
F401 'reviewboard.admin.form_widgets.RelatedUserWidget' imported but unused |
reviewbot | |
F401 'reviewboard.admin.form_widgets.RelatedRepositoryWidget' imported but unused |
reviewbot | |
F401 'reviewboard.admin.form_widgets.RelatedGroupWidget' imported but unused |
reviewbot | |
Blank line between these. |
brennie | |
attrs (dict, optional): |
brennie | |
We are overwriting this just below so this can be removed. |
brennie | |
Missing *args (tuple) and **kwargs (dict). |
brennie | |
attrs (dict, optional): |
brennie | |
Missing a docstring, which would look something like: Unit tests for RelatedUserWidget. |
brennie | |
On previous line. Same below. |
brennie | |
You may want to use self.assertHTMLEqual(a, b) which parses a and b and thencompares the resulting trees for equality, ignoring … |
brennie | |
E501 line too long (104 > 79 characters) |
reviewbot | |
E501 line too long (104 > 79 characters) |
reviewbot | |
E501 line too long (105 > 79 characters) |
reviewbot | |
Could you re-flow this as: value = ( my_form.fields['...'] .widget .value_from_datadict( {'people': ['1', '2']}, {}, 'people') ) Same below. |
brennie | |
Missing class-level docstring. |
brennie | |
This can go on a single line as {'id': 'repositories'} |
brennie | |
We generally prefer ) not on its own line. |
brennie | |
Missing class-level docstring. |
brennie | |
Missing class level docstring. |
brennie | |
Missing module-level docstring, e.g. Unit tests for reviewboard.notifications.models This file should be called test_admin. |
brennie | |
This should be WebhookTargetAdminTests, since it is testing the admin view explicitly. |
brennie | |
This should be OAuthAdminTests since it is explicitly testing the admin view. |
brennie | |
This docstring is wrong. It should be: Tests for reviewboard.oauth.admin. |
brennie | |
Missing module level docstring: Unit tests for reviewboard.reviews.admin. Also, this file should be renamed to test_admin.py so other reviews.admin functionality … |
brennie | |
Docstrings should be of the form: """Single line description Multi-line summary. """ In this case, the docstring should be updated … |
brennie | |
{% load %} should be the first line of the file, e.g. {% load djblets_js i18n %} {{input_html}} <script> |
brennie | |
{% load %} should be the first line of the file, e.g. {% load djblets_js i18n %} {{input_html}} <script> |
brennie | |
{% load %} should be the first line of the file, e.g. {% load djblets_js i18n %} {{input_html}} <script> |
brennie | |
E501 line too long (120 > 79 characters) |
reviewbot | |
E501 line too long (120 > 79 characters) |
reviewbot | |
E501 line too long (121 > 79 characters) |
reviewbot | |
E501 line too long (85 > 79 characters) |
reviewbot | |
E501 line too long (120 > 79 characters) |
reviewbot | |
E501 line too long (120 > 79 characters) |
reviewbot | |
E501 line too long (121 > 79 characters) |
reviewbot | |
E501 line too long (120 > 79 characters) |
reviewbot | |
E501 line too long (120 > 79 characters) |
reviewbot | |
E501 line too long (121 > 79 characters) |
reviewbot | |
Col: 17 'view' is defined but never used. |
reviewbot | |
Why are we now saving this into self ? |
brennie | |
Why are we saving this into self? |
brennie | |
dict |
brennie | |
E501 line too long (120 > 79 characters) |
reviewbot | |
E501 line too long (120 > 79 characters) |
reviewbot | |
E501 line too long (121 > 79 characters) |
reviewbot | |
""" on next line |
brennie | |
""" on next line. |
brennie | |
""" on next line. |
brennie | |
This test doesn't do anything. |
brennie | |
Col: 17 'view' is defined but never used. |
reviewbot | |
Leftover debug code? |
brennie | |
A widget to select related *groups* using search and autocomplete. |
shoven | |
Do we need this console.log still? And if we do, since this is an error perhaps console.error(...) would be better? |
shoven | |
Do we need this console.log still? And if we do, since this is an error perhaps console.error(...) would be better? |
shoven | |
E501 line too long (120 > 79 characters) |
reviewbot | |
E501 line too long (120 > 79 characters) |
reviewbot | |
E501 line too long (121 > 79 characters) |
reviewbot | |
Col: 17 'view' is defined but never used. |
reviewbot | |
E501 line too long (120 > 79 characters) |
reviewbot | |
E501 line too long (120 > 79 characters) |
reviewbot | |
E501 line too long (121 > 79 characters) |
reviewbot | |
I was wondering why you declared this template outside of the view. Couldn't you declare this inside of the RB.RelatedGroupSelectorView? … |
Sudolicious | |
E501 line too long (120 > 79 characters) |
reviewbot | |
E501 line too long (120 > 79 characters) |
reviewbot | |
E501 line too long (121 > 79 characters) |
reviewbot | |
Col: 20 Unexpected ')'. |
reviewbot | |
Col: 20 Expected an identifier and instead saw ')'. |
reviewbot | |
Col: 21 Expected ')' and instead saw ';'. |
reviewbot | |
Col: 22 Missing semicolon. |
reviewbot | |
E501 line too long (120 > 79 characters) |
reviewbot | |
E501 line too long (120 > 79 characters) |
reviewbot | |
E501 line too long (121 > 79 characters) |
reviewbot | |
E501 line too long (120 > 79 characters) |
reviewbot | |
E501 line too long (120 > 79 characters) |
reviewbot | |
E501 line too long (121 > 79 characters) |
reviewbot | |
E501 line too long (120 > 79 characters) |
reviewbot | |
E501 line too long (120 > 79 characters) |
reviewbot | |
E501 line too long (121 > 79 characters) |
reviewbot |
Change Summary:
I moved the JS Widgets into Djblets, and added a new initialization argument called using_avatars. This is because we can't assume in Djblets that the widget is using an avatar service.
I think this works for moving templates and JS files into Djblets, but let me know if I'm wrong.
Description: |
|
|||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Commit: |
|
|||||||||||||||
Diff: |
Revision 2 (+12 -547) |
Checks run (2 succeeded)
Change Summary:
Moved
relatedUserWidget
and relevant files back into Review Board repository. There are problems with the order the JS files are run, though, so widget will not currently render.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 3 (+110 -354) |
Checks run (2 succeeded)
Change Summary:
Widget now displays properly. JS code order was fixed, both JS files are called and run now.
Description: |
|
||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Testing Done: |
|
||||||||||||||||||||||||
Commit: |
|
||||||||||||||||||||||||
Diff: |
Revision 4 (+114 -356) |
Checks run (2 succeeded)
Change Summary:
Created
RelatedRespositoryWidget
along with related HTML and JS files. Doesn't currently function, I'm trying to figure out the ajax call.
Description: |
|
||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Testing Done: |
|
||||||||||||||||||||||||||||||||||||
Commit: |
|
||||||||||||||||||||||||||||||||||||
Diff: |
Revision 5 (+206 -365) |
Checks run (2 succeeded)
-
-
reviewboard/static/rb/js/admin/views/relatedRepoSelectorView.es6.js (Diff revision 5) This doesn't need to live on the prototype. It can live as a global (
const searchPlaceholderText = ...
) since you're wrapping everything in an IIFE.
Change Summary:
The RelatedRepositoryWidget functions and renders responses now. It is also extending
Djblets.RelatedObjectSelectorView
now, instead of usingRB.
.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 6 (+235 -370) |
Checks run (1 failed, 1 succeeded)
JSHint
-
reviewboard/static/rb/js/admin/views/relatedRepoSelectorView.es6.js (Diff revision 6) Col: 37 Missing semicolon.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 7 (+234 -370) |
Checks run (2 succeeded)
Change Summary:
Add the relatedGroupWidget, and replace the default Group selector widget. It uses /api/groups/ to search for groups.
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Testing Done: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
Commit: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
Diff: |
Revision 8 (+499 -373) |
Checks run (1 failed, 1 succeeded)
JSHint
-
reviewboard/static/rb/js/admin/views/relatedGroupSelectorView.es6.js (Diff revision 8) Col: 41 Expected '===' and instead saw '=='.
Change Summary:
Fix JSHint issue.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 9 (+499 -373) |
Checks run (2 succeeded)
Change Summary:
Adding skeleton code for python unit and JS tests.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 10 (+554 -373) |
Checks run (1 failed, 1 succeeded)
JSHint
-
reviewboard/static/rb/js/admin/tests/relatedUserSelectorViewTests.es6.js (Diff revision 10) Col: 42 Missing semicolon.
-
reviewboard/static/rb/js/admin/tests/relatedUserSelectorViewTests.es6.js (Diff revision 10) Col: 3 Missing semicolon.
Change Summary:
Change some code around with admin/tests.py
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 11 (+541 -373) |
Checks run (2 succeeded)
-
-
-
reviewboard/admin/tests.py (Diff revision 11) Did this work for you? I found that when running tests, pdb would interrupt control flow but I wouldn't be able to step through code or do anything other than continue the test.
Change Summary:
create relatedUserWidget Django Unit Test.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 12 (+569 -378) |
Checks run (2 succeeded)
Change Summary:
Added render unit tests for RelatedRepositoryWidget and RelatedGroupWidget. Modified some code style in RelatedUserWidget.
Description: |
|
|||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Testing Done: |
|
|||||||||||||||||||||||||||||||||||||||
Commit: |
|
|||||||||||||||||||||||||||||||||||||||
Diff: |
Revision 13 (+636 -377) |
Checks run (2 succeeded)
-
-
reviewboard/admin/form_widgets.py (Diff revision 9) I was wondering why you removed the init method. do you instantiate the local_site_name and multivalued variables else where? or you don't need them anymore as well
-
-
These tests does not actually test rendering at all, even though they . If it is testing rendering, I would expect it to test the generated HTML.
However, I'm not sure how valuable it is to test the rendering of a form since that is likely to change often and be quite fragile.
So I think we need to just change the names of the tests.
Perhaps instead of testing specific instances of where they are used, we should just make a test form for each testcase and use that instead:
e.g.
class RelatedUserWidgetTestCase(TestCase): class TestForm(forms.Form): my_multiselect_field = # ... def test_#... class RelatedRepositoryWidgetTestCase(TestCase): class TestForm(forms.Form): my_multiselect_field = # ... def test_#...
In this way the test cases are isolated to specifically the widget and do not have to deal with any details of specific form cases.
That being said, the test you have written that test the OAuth application form does the correct redirect is still valuable! This is a good test case and I think we should keep it as a separate test case (in a e.g.,
ApplicationAdminTests
inreviewboard/oauth/tests/tests.py
-- or at least I think that is where it should go. Maybe ask chipx86 or david to double check?). -
reviewboard/admin/form_widgets.py (Diff revision 13) who's already in the list
I think this was left over from copy & paste, as it should say:
which repositories are already in the list
-
-
-
-
reviewboard/admin/tests.py (Diff revision 13) No period, as unit tests are printed as:
TEST_DOCSTRING ... OK
Same for all other tests.
-
-
reviewboard/admin/tests.py (Diff revision 13) You definitely don't want to use
str
here.str
means two differen things depending on your version of Python.On Python 2,
str
is thebytes
type, e.g., it represents raw binary data.On Python 3,
str
represents a text type (what wasunicode
in Python 2).However, you can also just do the following and not have to worry about character types:
self.assertRedirects(response, '/admib/db/oauth/application/%s/' % test_user.pk)
-
reviewboard/admin/tests.py (Diff revision 13) This only works by accident. YOu should be retrieving the latest
Application
and using itspk
here instead, e.g.application = Application.objects.latest() # use application.pk
-
-
-
reviewboard/admin/tests.py (Diff revision 13) Same comment here about string types.
test_repo.pk
is not correct. This should beWebHookTarget.objects.latest().pk
-
reviewboard/admin/tests.py (Diff revision 13) Again, this should use
%
formatting and this only works as a fluke thattest_group.pk == DefaultReviewer.objects.latest().pk
. (e.g., they're both 1). -
reviewboard/scmtools/forms.py (Diff revision 13) can you use a keyword argument for whatever
True
is? (Is itrequired=
?). -
-
reviewboard/static/rb/js/admin/views/relatedGroupSelectorView.es6.js (Diff revision 13) This should only be indented one space relative to the line above.
-
reviewboard/static/rb/js/admin/views/relatedGroupSelectorView.es6.js (Diff revision 13) This should be
this._inviteOnly
. -
reviewboard/static/rb/js/admin/views/relatedGroupSelectorView.es6.js (Diff revision 13) This can just do
return optionTemplate(item)
since the template shouldn't be modifying the item. -
reviewboard/static/rb/js/admin/views/relatedGroupSelectorView.es6.js (Diff revision 13) const
if the variable is not being rebound,let
otherwise.Also, this should be
localInviteOnly
. JS useslowerCamelCase
. -
reviewboard/static/rb/js/admin/views/relatedGroupSelectorView.es6.js (Diff revision 13) This doesn't bother me, but another mentor is going to tell you to do
succes: results => { ... }
instead of using the shorthand. -
reviewboard/static/rb/js/admin/views/relatedGroupSelectorView.es6.js (Diff revision 13) this mapping function is happening twice, so we should pull it out into e.g.
this._resultToItem
or similar. However, if we do that, then we definitely have to use thesuccess: results => { ... }
syntax becuase otherwisethis
will be lost (as thefoo() {...}
shorthand does not bind the function, but() => {}
does). -
-
reviewboard/static/rb/js/admin/views/relatedRepoSelectorView.es6.js (Diff revision 13) This should only be indented one space relative to the line above.
-
reviewboard/static/rb/js/admin/views/relatedRepoSelectorView.es6.js (Diff revision 13) Not strictly necessary, but I imagine another mentor will tell you not to use shorthand object method syntax here.
-
reviewboard/static/rb/js/admin/views/relatedRepoSelectorView.es6.js (Diff revision 13) Not strictly necessary, but I imagine another mentor will tell you not to use shorthand object method syntax here.
-
-
-
-
-
-
reviewboard/admin/form_widgets.py (Diff revision 13) This can easily be:
repo_data = [ { 'id': repo.pk, 'name': repo.name, } for repo in self.existing_repos ]
-
reviewboard/admin/form_widgets.py (Diff revision 13) It'd be better to have the template take the HTML for the input element and have it take care of positioning, rather than concatenating.
-
reviewboard/admin/form_widgets.py (Diff revision 13) Can you instead do:
The list of IDs of :py:class:`~reviewboard.scmtools.models.Repository` objects.
Wrapping appropriately. (You can wrap at a
.
inside the reference, if needed.) -
-
-
-
reviewboard/admin/tests.py (Diff revision 13) Since these aren't doing anything special, you can remove them.
-
reviewboard/admin/tests.py (Diff revision 13) A better way to wrap would be:
user_widget = \ response.context['adminform'].form.fields['user'].widget.widget
Same with tests below.
-
reviewboard/admin/tests.py (Diff revision 13) This can be one request, like:
response = self.client.post( '.....', { ... })
Same with tests below.
-
-
-
reviewboard/scmtools/forms.py (Diff revision 13) Can you make sure that the label is still appropriate?
-
reviewboard/static/rb/js/admin/views/relatedGroupSelectorView.es6.js (Diff revision 13) Two blank lines between these.
-
reviewboard/static/rb/js/admin/views/relatedGroupSelectorView.es6.js (Diff revision 13) Two blank lines between these.
-
reviewboard/static/rb/js/admin/views/relatedGroupSelectorView.es6.js (Diff revision 13) The string needs to be wrapped with
gettext(...)
.Does this need to be here? Why isn't it just being set on the object?
-
reviewboard/static/rb/js/admin/views/relatedGroupSelectorView.es6.js (Diff revision 13) This should be called
inviteOnly
in JavaScript. -
-
reviewboard/static/rb/js/admin/views/relatedRepoSelectorView.es6.js (Diff revision 13) Typo: "multuple" -> "multiple"
-
reviewboard/static/rb/js/admin/views/relatedRepoSelectorView.es6.js (Diff revision 13) No need for the
_.extend
, since there isn't a dictionary to extend. You should be able to just passitem
. -
reviewboard/staticbundles.py (Diff revision 13) This is technically an API breakage. Any extensions pulling in
widgets
will now fail. I assume this is due to the addition of the widget in Djblets, and if so, then we should just rename that one. -
-
reviewboard/templates/admin/related_group_widget.html (Diff revision 13) This can just be
<script>
these days. -
reviewboard/templates/admin/related_group_widget.html (Diff revision 13) As above, this should be
inviteOnly
. -
reviewboard/templates/admin/related_repo_widget.html (Diff revision 13) This can just be
<script>
these days.
Change Summary:
add code style fixes based on comments from mentors.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 14 (+624 -379) |
Checks run (2 succeeded)
Change Summary:
Changed widget tests into form tests, and moved them to proper locations. Fixed a bunch of code style issues.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 15 (+662 -383) |
Checks run (1 failed, 1 succeeded)
flake8
-
reviewboard/admin/tests.py (Diff revision 15) F401 'reviewboard.admin.form_widgets.RelatedUserWidget' imported but unused
-
reviewboard/admin/tests.py (Diff revision 15) F401 'reviewboard.admin.form_widgets.RelatedRepositoryWidget' imported but unused
-
reviewboard/admin/tests.py (Diff revision 15) F401 'reviewboard.admin.form_widgets.RelatedGroupWidget' imported but unused
Change Summary:
updated widget unit tests for
RelatedUserWidget
,RelatedRepositoryWidget
andRelatedGroupWidget
, based on mentor feedback.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 16 (+993 -383) |
Checks run (1 failed, 1 succeeded)
flake8
-
-
In your description it says:
Moved
RelatedObjectWidget
into Djblets.This patch doesn't actually do that (since it doesn't affect Djblets.) Instead it should say something like:
Now that
RelatedObjectedWidget
is in Djblets, we import
it from there and extend it in theRelatedUserWidget
. -
-
-
reviewboard/admin/form_widgets.py (Diff revision 16) We are overwriting this just below so this can be removed.
-
-
-
reviewboard/admin/tests.py (Diff revision 16) Missing a docstring, which would look something like:
Unit tests for RelatedUserWidget.
-
-
reviewboard/admin/tests.py (Diff revision 16) You may want to use
self.assertHTMLEqual(a, b)
which parsesa
andb
and thencompares the resulting trees for equality, ignoring whitespace and attribute ordering.Same goes for all the other tests doing
assertIn
with HTML. -
reviewboard/admin/tests.py (Diff revision 16) You do not actually need the parentheses here (or below).
-
reviewboard/admin/tests.py (Diff revision 16) Could you re-flow this as:
value = ( my_form.fields['...'] .widget .value_from_datadict( {'people': ['1', '2']}, {}, 'people') )
Same below.
-
-
reviewboard/admin/tests.py (Diff revision 16) This can go on a single line as
{'id': 'repositories'}
-
-
-
-
reviewboard/notifications/tests/test_webhook_target_admin.py (Diff revision 16) Missing module-level docstring, e.g.
Unit tests for reviewboard.notifications.models
This file should be called
test_admin
. -
reviewboard/notifications/tests/test_webhook_target_admin.py (Diff revision 16) This should be
WebhookTargetAdminTests
, since it is testing the admin view explicitly. -
reviewboard/oauth/tests.py (Diff revision 16) This should be
OAuthAdminTests
since it is explicitly testing the admin view. -
reviewboard/oauth/tests.py (Diff revision 16) This docstring is wrong. It should be:
Tests for reviewboard.oauth.admin.
-
reviewboard/reviews/tests/test_default_reviewer_admin.py (Diff revision 16) Missing module level docstring:
Unit tests for reviewboard.reviews.admin.
Also, this file should be renamed to
test_admin.py
so otherreviews.admin
functionality can be tested here in the future (as the testcases are quite short). -
reviewboard/reviews/tests/test_default_reviewer_admin.py (Diff revision 16) Docstrings should be of the form:
"""Single line description Multi-line summary. """
In this case, the docstring should be updated to:
Tests for reviewboard.reviews.admin.DefaultReviewerAdmin.
-
reviewboard/templates/admin/related_group_widget.html (Diff revision 16) {% load %}
should be the first line of the file, e.g.{% load djblets_js i18n %} {{input_html}} <script>
-
reviewboard/templates/admin/related_repo_widget.html (Diff revision 16) {% load %}
should be the first line of the file, e.g.{% load djblets_js i18n %} {{input_html}} <script>
-
reviewboard/templates/admin/related_user_widget.html (Diff revision 16) {% load %}
should be the first line of the file, e.g.{% load djblets_js i18n %} {{input_html}} <script>
Change Summary:
fixed code style issues, as well as added documentation for tests, based on mentor feedback.
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Testing Done: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
Commit: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
Diff: |
Revision 17 (+1074 -384) |
Checks run (1 failed, 1 succeeded)
flake8
Change Summary:
fixed a silly mistake
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 18 (+1075 -384) |
Checks run (1 failed, 1 succeeded)
flake8
Change Summary:
Fixed some issues with the admin form tests. Also managed to figure out how to import the correct JS static bundle to use in the JS tests for the new widgets. Cleaned up some javascript bundle import code that wasn't needed anymore, as well as corrected some names.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 19 (+1084 -389) |
Checks run (2 failed)
flake8
JSHint
-
reviewboard/static/rb/js/admin/tests/relatedUserSelectorViewTests.es6.js (Diff revision 19) Col: 17 'view' is defined but never used.
Change Summary:
Change title, out of WIP
Summary: |
|
||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
Change Summary:
change form tests to use reverse() instead of hardcoding urls.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 20 (+1098 -389) |
Checks run (2 failed)
flake8
JSHint
-
reviewboard/static/rb/js/admin/tests/relatedUserSelectorViewTests.es6.js (Diff revision 20) Col: 17 'view' is defined but never used.
-
-
-
-
-
-
-
-
reviewboard/static/rb/js/admin/tests/relatedUserSelectorViewTests.es6.js (Diff revision 20) This test doesn't do anything.
-
reviewboard/static/rb/js/admin/tests/relatedUserSelectorViewTests.es6.js (Diff revision 20) Leftover debug code?
Change Summary:
"JS tests incomplete" in Testing Done description.
Testing Done: |
|
---|
-
-
reviewboard/static/rb/js/admin/views/relatedGroupSelectorView.es6.js (Diff revision 20) A widget to select related *groups* using search and autocomplete.
-
reviewboard/static/rb/js/admin/views/relatedGroupSelectorView.es6.js (Diff revision 20) Do we need this console.log still? And if we do, since this is an error perhaps
console.error(...)
would be better? -
reviewboard/static/rb/js/admin/views/relatedRepoSelectorView.es6.js (Diff revision 20) Do we need this console.log still? And if we do, since this is an error perhaps
console.error(...)
would be better?
Change Summary:
Address Barret and Sarah's feedback. Got rid of self in "self.existing_object" calls, there was no need for it. Fixed some minor code comments.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 21 (+960 -387) |
Checks run (2 failed)
flake8
JSHint
-
reviewboard/static/rb/js/admin/tests/relatedUserSelectorViewTests.es6.js (Diff revision 21) Col: 17 'view' is defined but never used.
Change Summary:
Add Select Item from Dropdown and Rendering with Inital Options JS test, and rework other relatedUserSelector JS tests
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 22 (+1046 -387) |
Checks run (1 failed, 1 succeeded)
flake8
-
Hey Storm, this is looking really good!
-
reviewboard/static/rb/js/admin/views/relatedGroupSelectorView.es6.js (Diff revision 22) I was wondering why you declared this template outside of the view. Couldn't you declare this inside of the
RB.RelatedGroupSelectorView
?
So instead maybe it could be something like this?RB.RelatedGroupSelectorView = Djblets.RelatedObjectSelectorView.extend({ searchPlaceholderText: gettext('Search for groups...'), optionTemplate = _.template(dedent` <div> <span class="title"><%- name %> : <%- display_name %></span> </div> `);
Change Summary:
update a selectize readme, fix a css bug, and add group and repo widget JS tests
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 23 (+1246 -390) |
Checks run (2 failed)
flake8
JSHint
-
reviewboard/static/rb/js/admin/tests/relatedGroupSelectorViewTests.es6.js (Diff revision 23) Col: 20 Unexpected ')'.
-
reviewboard/static/rb/js/admin/tests/relatedGroupSelectorViewTests.es6.js (Diff revision 23) Col: 20 Expected an identifier and instead saw ')'.
-
reviewboard/static/rb/js/admin/tests/relatedGroupSelectorViewTests.es6.js (Diff revision 23) Col: 21 Expected ')' and instead saw ';'.
-
reviewboard/static/rb/js/admin/tests/relatedGroupSelectorViewTests.es6.js (Diff revision 23) Col: 22 Missing semicolon.
Change Summary:
fix group widget JS test comma syntax error
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 24 (+1246 -390) |
Checks run (1 failed, 1 succeeded)
flake8
Change Summary:
forgot to define the repo and group JS tests in static bundles, also renamed repo widget test.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 25 (+1246 -390) |
Checks run (1 failed, 1 succeeded)
flake8
Change Summary:
move selectize.js out of reviewboard, into djblets.
Testing Done: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Commit: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Diff: |
Revision 26 (+1243 -4448) |