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:
-
[Work in Progress]
Moved RelatedUserWidget into Djblets. The widget is imported from Djblets now.
~ See Patch #10214. ~ See /r/10214. - Commit:
-
b44f045814e753a8406ba2a7fc3b7e7da4df293a2b2edf0e4e64b85a813ed1ebda9bf44cbc96f715
- 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:
-
2b2edf0e4e64b85a813ed1ebda9bf44cbc96f715459dff6970d9cfa359681693918df1421f45d9a3
Checks run (2 succeeded)
- Change Summary:
-
Widget now displays properly. JS code order was fixed, both JS files are called and run now.
- Description:
-
[Work in Progress]
~ Moved RelatedUserWidget into Djblets. The widget is imported from Djblets now.
~ See /r/10214. ~ Moved
RelatedObjectWidget
into Djblets. The widget is imported from Djblets now,~ and extended by RelatedUserWidget
.+ + See /r/10214.
- Testing Done:
-
~ Ran
./tests/runtests.py
and no errors were thrown.~ Navigated to /admin/db/reviews/defaultreviewer/add/
and the Smart~ Multi Select User Widget worked as normal. ~ Ran
./tests/runtests.py
and no errors were thrown.~ ~ Navigated to
/admin/db/reviews/defaultreviewer/add/
and the Smart+ Select User Widget works as normal. - Commit:
-
459dff6970d9cfa359681693918df1421f45d9a39b2e2cf5553f0e0fefee045758e6c71fda238990
- 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:
-
[Work in Progress]
~ Moved
RelatedObjectWidget
into Djblets. The widget is imported from Djblets now,~ and extended by RelatedUserWidget
.~ Moved
RelatedObjectWidget
into Djblets. The widget is imported from Djblets~ now, and extended by RelatedUserWidget
.+ + Created
RelatedRepositoryWidget
, along with related HTML and JS files, which+ extends the RelatedObjectsWidget
. Currently displaying on+ /admin/db/reviews/defaultreviewer/add/
, but doesn't function.See /r/10214.
- Testing Done:
-
Ran
./tests/runtests.py
and no errors were thrown.Navigated to
/admin/db/reviews/defaultreviewer/add/
and the Smart~ Select User Widget works as normal. ~ Select User Widget works as normal. The RelatedRepositoryWidget
+ doesn't currently function. - Commit:
-
9b2e2cf5553f0e0fefee045758e6c71fda238990d5e82c3e4862c66cbb0f0510996466c03b931848
- Diff:
-
Revision 5 (+206 -365)
Checks run (2 succeeded)
- Change Summary:
-
The RelatedRepositoryWidget functions and renders responses now. It is also extending
Djblets.RelatedObjectSelectorView
now, instead of usingRB.
. - Commit:
-
d5e82c3e4862c66cbb0f0510996466c03b93184864a92a43ad1e5ee9b9799e0ddbd1f3c3fd3b2036
- Diff:
-
Revision 6 (+235 -370)
- Commit:
-
64a92a43ad1e5ee9b9799e0ddbd1f3c3fd3b2036c383d3c2a24f1172a5f28b72419239fabf9ecfd1
- 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:
-
[Work in Progress]
~ Moved
RelatedObjectWidget
into Djblets. The widget is imported from Djblets~ Moved
RelatedObjectWidget
into Djblets. The widget is imported from Djbletsnow, and extended by RelatedUserWidget
.~ Created
RelatedRepositoryWidget
, along with related HTML and JS files, which~ extends the RelatedObjectsWidget
. Currently displaying on~ /admin/db/reviews/defaultreviewer/add/
, but doesn't function.~ Created
RelatedRepositoryWidget
andRelatedGroupWidget
, along with~ relevant HTML and JS files, which extends the RelatedObjectsWidget
.~ RelatedGroupWidget
has the ability to only display groups that are+ invite only. All three widgets are displaying on + /admin/db/reviews/defaultreviewer/add/
, and they all function.See /r/10214.
- Testing Done:
-
~ Ran
./tests/runtests.py
and no errors were thrown.~ Ran
./tests/runtests.py
and no errors were thrown. Ran the js-tests, and+ no errors were thrown. Navigated to
/admin/db/reviews/defaultreviewer/add/
and the Smart~ Select User Widget works as normal. The RelatedRepositoryWidget
~ doesn't currently function. ~ Select User Widget works as normal. Both the RelatedRepositoryWidget
~ and the RelatedGroupWidget
also function as intended. - Commit:
-
c383d3c2a24f1172a5f28b72419239fabf9ecfd1a519a7a8f71fcac0c694ad8042ae18c9e6259e1e
- Diff:
-
Revision 8 (+499 -373)
- Change Summary:
-
Fix JSHint issue.
- Commit:
-
a519a7a8f71fcac0c694ad8042ae18c9e6259e1e80dc7cb7f71f1edd9d50f90e48b14e64dd13665a
- Diff:
-
Revision 9 (+499 -373)
Checks run (2 succeeded)
- Change Summary:
-
Adding skeleton code for python unit and JS tests.
- Commit:
-
80dc7cb7f71f1edd9d50f90e48b14e64dd13665a34186bab1c2ff4dc94ec8f36e6e68076b16e7080
- Diff:
-
Revision 10 (+554 -373)
- Change Summary:
-
Change some code around with admin/tests.py
- Commit:
-
34186bab1c2ff4dc94ec8f36e6e68076b16e70803f954f325305b3aa349871f99e3f34adebe53fb0
- Diff:
-
Revision 11 (+541 -373)
Checks run (2 succeeded)
- Change Summary:
-
create relatedUserWidget Django Unit Test.
- Commit:
-
3f954f325305b3aa349871f99e3f34adebe53fb0ffe8aecbe6b51d48e66468f010acd9c564a892dd
- 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:
-
[Work in Progress]
Moved
RelatedObjectWidget
into Djblets. The widget is imported from Djbletsnow, and extended by RelatedUserWidget
.Created
RelatedRepositoryWidget
andRelatedGroupWidget
, along withrelevant HTML and JS files, which extends the RelatedObjectsWidget
.RelatedGroupWidget
has the ability to only display groups that are~ invite only. All three widgets are displaying on ~ invite only. All three widgets, for exampe, can be viewed on /admin/db/reviews/defaultreviewer/add/
, and they all function.See /r/10214.
- Testing Done:
-
Ran
./tests/runtests.py
and no errors were thrown. Ran the js-tests, andno errors were thrown. ~ Navigated to
/admin/db/reviews/defaultreviewer/add/
and the Smart~ Select User Widget works as normal. Both the RelatedRepositoryWidget
~ and the RelatedGroupWidget
also function as intended.~ Navigated to
/admin/db/reviews/defaultreviewer/add/
and the~ RelatedUserWidget
,RelatedRepositoryWidget
and~ RelatedGroupWidget
function as intended. - Commit:
-
ffe8aecbe6b51d48e66468f010acd9c564a892ddd04369f91f67b57908079dab2d7b03af2386564f
- Diff:
-
Revision 13 (+636 -377)
Checks run (2 succeeded)
-
-
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?). -
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
-
-
-
-
-
-
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)
-
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
-
-
-
Same comment here about string types.
test_repo.pk
is not correct. This should beWebHookTarget.objects.latest().pk
-
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). -
-
-
-
-
-
const
if the variable is not being rebound,let
otherwise.Also, this should be
localInviteOnly
. JS useslowerCamelCase
. -
This doesn't bother me, but another mentor is going to tell you to do
succes: results => { ... }
instead of using the shorthand. -
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). -
-
-
Not strictly necessary, but I imagine another mentor will tell you not to use shorthand object method syntax here.
-
Not strictly necessary, but I imagine another mentor will tell you not to use shorthand object method syntax here.
-
-
-
-
-
-
This can easily be:
repo_data = [ { 'id': repo.pk, 'name': repo.name, } for repo in self.existing_repos ]
-
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.
-
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.) -
-
-
-
-
A better way to wrap would be:
user_widget = \ response.context['adminform'].form.fields['user'].widget.widget
Same with tests below.
-
This can be one request, like:
response = self.client.post( '.....', { ... })
Same with tests below.
-
-
-
-
-
-
The string needs to be wrapped with
gettext(...)
.Does this need to be here? Why isn't it just being set on the object?
-
-
-
-
No need for the
_.extend
, since there isn't a dictionary to extend. You should be able to just passitem
. -
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. -
-
-
-
- Change Summary:
-
add code style fixes based on comments from mentors.
- Commit:
-
d04369f91f67b57908079dab2d7b03af2386564f71783bdf6f38682d5332da0c7047503ac9f5e59b
- 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:
-
71783bdf6f38682d5332da0c7047503ac9f5e59bb0072ee1df6272dbbce01dc8f91355c4e2c76793
- Diff:
-
Revision 15 (+662 -383)
Checks run (1 failed, 1 succeeded)
flake8
- Change Summary:
-
updated widget unit tests for
RelatedUserWidget
,RelatedRepositoryWidget
andRelatedGroupWidget
, based on mentor feedback. - Commit:
-
b0072ee1df6272dbbce01dc8f91355c4e2c767939536023a78ca53ac3dae0e6e6dacccb68b151df0
- Diff:
-
Revision 16 (+993 -383)
-
-
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
. -
-
-
-
-
-
-
-
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. -
-
Could you re-flow this as:
value = ( my_form.fields['...'] .widget .value_from_datadict( {'people': ['1', '2']}, {}, 'people') )
Same below.
-
-
-
-
-
-
Missing module-level docstring, e.g.
Unit tests for reviewboard.notifications.models
This file should be called
test_admin
. -
-
-
-
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). -
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.
-
{% load %}
should be the first line of the file, e.g.{% load djblets_js i18n %} {{input_html}} <script>
-
{% load %}
should be the first line of the file, e.g.{% load djblets_js i18n %} {{input_html}} <script>
-
{% 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:
-
[Work in Progress]
~ Moved
RelatedObjectWidget
into Djblets. The widget is imported from Djblets~ now, and extended by RelatedUserWidget
.~ Now that
RelatedObjectedWidget
is in Djblets, we import~ it from there and extend it in the RelatedUserWidget
.Created
RelatedRepositoryWidget
andRelatedGroupWidget
, along withrelevant HTML and JS files, which extends the RelatedObjectsWidget
.RelatedGroupWidget
has the ability to only display groups that areinvite only. All three widgets, for exampe, can be viewed on /admin/db/reviews/defaultreviewer/add/
, and they all function.See /r/10214.
- Testing Done:
-
Ran
./tests/runtests.py
and no errors were thrown. Ran the js-tests, andno 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
.+ + Other tests in reviewboard.notifications.tests.test_admin,
+ reviewboard.reviews.tests.test_admin, and + reviewboard.oauth.tests test that forms which utilize these new widgets + can properly save data. + Navigated to
/admin/db/reviews/defaultreviewer/add/
and theRelatedUserWidget
,RelatedRepositoryWidget
andRelatedGroupWidget
function as intended. - Commit:
-
9536023a78ca53ac3dae0e6e6dacccb68b151df01a2b0d63b7e62d7b522df8cef7d05d540cf79c75
- Diff:
-
Revision 17 (+1074 -384)
- Change Summary:
-
fixed a silly mistake
- Commit:
-
1a2b0d63b7e62d7b522df8cef7d05d540cf79c75a7a6f14d11a6caf5e3cc93853b33ad687eacb3ae
- Diff:
-
Revision 18 (+1075 -384)
- 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:
-
a7a6f14d11a6caf5e3cc93853b33ad687eacb3ae7e36799068d54cae577fd091a3a5097e4ccf2820
- Diff:
-
Revision 19 (+1084 -389)
- Change Summary:
-
Change title, out of WIP
- Summary:
-
[WIP] Replace old selectors with smarter objects selector widget in the administration UIReplace old selectors with smart objects selector widget in the administration UI
- Description:
-
- [Work in Progress]
- Now that
RelatedObjectedWidget
is in Djblets, we importit from there and extend it in the RelatedUserWidget
.Created
RelatedRepositoryWidget
andRelatedGroupWidget
, along withrelevant HTML and JS files, which extends the RelatedObjectsWidget
.RelatedGroupWidget
has the ability to only display groups that areinvite only. All three widgets, for exampe, can be viewed on /admin/db/reviews/defaultreviewer/add/
, and they all function.See /r/10214.
- Change Summary:
-
change form tests to use reverse() instead of hardcoding urls.
- Commit:
-
7e36799068d54cae577fd091a3a5097e4ccf2820b2faf32cfc0ad8a412d06966992cfbb017293d6d
- Diff:
-
Revision 20 (+1098 -389)
- Change Summary:
-
"JS tests incomplete" in Testing Done description.
- Testing Done:
-
+ JS Tests are currently incomplete.
+ Ran
./tests/runtests.py
and no errors were thrown. Ran the js-tests, andno 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
.Other tests in reviewboard.notifications.tests.test_admin,
reviewboard.reviews.tests.test_admin, and reviewboard.oauth.tests test that forms which utilize these new widgets can properly save data. Navigated to
/admin/db/reviews/defaultreviewer/add/
and theRelatedUserWidget
,RelatedRepositoryWidget
andRelatedGroupWidget
function as intended.
- 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:
-
b2faf32cfc0ad8a412d06966992cfbb017293d6df3c4f3a9444ed40db1ba4deb6f08bc3301cf3b51
- Diff:
-
Revision 21 (+960 -387)
- Change Summary:
-
Add Select Item from Dropdown and Rendering with Inital Options JS test, and rework other relatedUserSelector JS tests
- Commit:
-
f3c4f3a9444ed40db1ba4deb6f08bc3301cf3b51c29a20c8a8137ee6f6e2791ba10f94f2ce124d6b
- Diff:
-
Revision 22 (+1046 -387)
-
Hey Storm, this is looking really good!
-
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:
-
c29a20c8a8137ee6f6e2791ba10f94f2ce124d6b10a837367fb91686915e8f564b2c9c92be4907f7
- Diff:
-
Revision 23 (+1246 -390)
Checks run (2 failed)
flake8
JSHint
- Change Summary:
-
fix group widget JS test comma syntax error
- Commit:
-
10a837367fb91686915e8f564b2c9c92be4907f77766cd5e06745a871d81f3b7d79b289b0b94234d
- Diff:
-
Revision 24 (+1246 -390)
- Change Summary:
-
forgot to define the repo and group JS tests in static bundles, also renamed repo widget test.
- Commit:
-
7766cd5e06745a871d81f3b7d79b289b0b94234d6bd8b826530bbf0d8ce3ece3e56541f44050bb32
- Diff:
-
Revision 25 (+1246 -390)
- Change Summary:
-
move selectize.js out of reviewboard, into djblets.
- Testing Done:
-
~ JS Tests are currently incomplete.
~ 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, andno errors were thrown. ~ New unit tests were created in reviewboard.admin.tests that test
~ New unit tests were created in
reviewboard.admin.tests
that testthe functionality of the widgets. The test classes are: RelatedUserWidgetTestCase
,RelatedRepositoryWidgetTestCase
and,RelatedGroupWidgetTestCase
.- Other tests in reviewboard.notifications.tests.test_admin,
- reviewboard.reviews.tests.test_admin, and - reviewboard.oauth.tests test that forms which utilize these new widgets - can properly save data. - Navigated to
/admin/db/reviews/defaultreviewer/add/
and theRelatedUserWidget
,RelatedRepositoryWidget
andRelatedGroupWidget
function as intended. - Commit:
-
6bd8b826530bbf0d8ce3ece3e56541f44050bb3211714f443c8b2834f3dc3f0e9d570808d9c9f09f
- Diff:
-
Revision 26 (+1243 -4448)