This adds a new widget called issues that replaces the githubissues and pagureissues widgets. It consolodates these into a single widget that draws the repos from the team hub config
rebased onto 4963c3695da15bff86f266d4946cf414b1ecab62
rebased, and updated this PR with changes from the comments in #538
also, fixed the tests on thsi one too (forgot to do this earlier...)
What about PR #501 ? It looks like duplicate effort, no?
@abompard for me they are a different IMHO. the user issues widget shows tickets for a user to action, and ones they have filed.
This one is more designed for a team hub to just show the most recent ones filed.
/me hopes this makes sense...
@abompard what do you think we should do with this one? should we just ship it for the teams hub fro 1.0? and change the issues widget that works on user and streams later?
we also need to remove pagureissues and github issues widgets at some point too IMHO. there is the bugzilla widget as well, that i think can be removed as well.
I agree with all that. Let's ship this one and when the issues widget gains team support we'll be able to migrate the few teams that we have created and that may have added this one on their hub.
Let's remove the others too.
thanks @abompard
any review items on this one, or can we merge?
It has to be rebased first, and the widget name conflicts with shaily's issues widget so you need to use another one.
rebased onto 3d7ec93ff3488260455b002654ea3627b5549300
rebased and renamed. This now also removes the bugzilla widget too.
Elsewhere you've converted that to a timestamp (using the timestamp attribute), I think it's safer to do it here too because of the serializing that will happen before caching.
timestamp
Same comment as above about timestamp.
It's not about this PR but here there's a conversion to timestamp missing too, it caused a traceback when I tried to display the pullrequests widget.
pullrequests
thanks @abompard! just fixed the three timestamp issues up there.
rebased onto a8511955b2959a68d35134389f2172cf7080958d
The hubs.tests.utils.test_views:ViewUtilsTest.test_move_widget now fails because it was using the "bugzilla" widget. I think you can just replace the bugzilla widget name with your new widget, that should work.
hubs.tests.utils.test_views:ViewUtilsTest.test_move_widget
bugzilla
There's also a test named test_post_invalid_config in TestAPIHubWidgets that uses the bugzilla widget. This one is trickier to fix because we don't have any widget left with required parameters, so we have to mock it. I suggest the following patch:
test_post_invalid_config
TestAPIHubWidgets
diff --git a/hubs/tests/views/test_api_hub_widget.py b/hubs/tests/views/test_api_hub_widget.py index 8016d835..7c7bd2ca 100644 --- a/hubs/tests/views/test_api_hub_widget.py +++ b/hubs/tests/views/test_api_hub_widget.py @@ -200,32 +200,35 @@ class TestAPIHubWidgets(APPTest): def test_post_invalid_config(self): hub = Hub.by_name("ralph", "user") self.session.add(Widget( - hub=hub, plugin="bugzilla", index=0)) + hub=hub, plugin="newestissues", index=0)) self.session.commit() self.assertEqual( Widget.query.filter_by( - hub=hub, plugin="bugzilla").count(), 1) + hub=hub, plugin="newestissues").count(), 1) + widget_class = registry["newestissues"] data = { - "name": "bugzilla", + "name": "newestissues", "config": {"foo": "bar"}, 'position': 'right', } user = FakeAuthorization('ralph') - with auth_set(app, user): - result = self.app.post( - '/api/hubs/%s/widgets/' % hub.id, - content_type="application/json", - data=json.dumps(data)) + with patch.object( + widget_class, "parameters", [{"name": "required"}]): + with auth_set(app, user): + result = self.app.post( + '/api/hubs/%s/widgets/' % hub.id, + content_type="application/json", + data=json.dumps(data)) self.assertEqual(result.status_code, 200) self.assertEqual( json.loads(result.get_data(as_text=True)), { "status": "ERROR", - "message": "You must provide a value for: username", + "message": "You must provide a value for: required", }) self.assertEqual( Widget.query.filter_by( - hub=hub, plugin="bugzilla").count(), 1) + hub=hub, plugin="newestissues").count(), 1) class TestAPIHubWidget(APPTest):
@abompard thanks for the patch! applied and fixed!
rebased onto e103644b5abae5e3207aeeaa493e4bafd84a9503
Almost there! Flake8 says:
./hubs/tests/utils/test_views.py:59:80: E501 line too long (82 > 79 characters)
@abompard thanks! fixed the linting issue, and rebased!
rebased onto 6e44e3301b0b6963c6d41c68a01d073e8ba1cef4
Pull-Request has been merged by abompard
This adds a new widget called issues that replaces the
githubissues and pagureissues widgets. It consolodates these into a
single widget that draws the repos from the team hub config