[allura:tickets] #8323 gsoc19 - Trigger notification task per each artifact creation/modification and add tests
- **status**: review --> closed - **Comment**: Looks good, merged! I did notice the link text for merge requests wasn't too great, so created [#8327] for that. --- ** [tickets:#8323] gsoc19 - Trigger notification task per each artifact creation/modification and add tests** **Status:** closed **Milestone:** unreleased **Labels:** gsoc19 **Created:** Mon Aug 12, 2019 04:50 PM UTC by Shalitha Suranga **Last Updated:** Sun Aug 25, 2019 06:27 AM UTC **Owner:** Shalitha Suranga Add a test for the send_usermentions_notification task. Also.. `send_usermentions_notification` task is only called in a few places so far, but would be good to do in all the places where a new artifact is created/modified(content) (new wiki page, new ticket, new blog post, new merge request). Maybe a new ticket for all that together. --- Sent from forge-allura.apache.org because dev@allura.apache.org is subscribed to https://forge-allura.apache.org/p/allura/tickets/ To unsubscribe from further messages, a project admin can change settings at https://forge-allura.apache.org/p/allura/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
[allura:tickets] #8323 gsoc19 - Trigger notification task per each artifact creation/modification and add tests
Hi.. @brondsem I have updated `ss/8323` with the test case please check Thanks --- ** [tickets:#8323] gsoc19 - Trigger notification task per each artifact creation/modification and add tests** **Status:** review **Milestone:** unreleased **Labels:** gsoc19 **Created:** Mon Aug 12, 2019 04:50 PM UTC by Shalitha Suranga **Last Updated:** Sun Aug 25, 2019 01:09 AM UTC **Owner:** Shalitha Suranga Add a test for the send_usermentions_notification task. Also.. `send_usermentions_notification` task is only called in a few places so far, but would be good to do in all the places where a new artifact is created/modified(content) (new wiki page, new ticket, new blog post, new merge request). Maybe a new ticket for all that together. --- Sent from forge-allura.apache.org because dev@allura.apache.org is subscribed to https://forge-allura.apache.org/p/allura/tickets/ To unsubscribe from further messages, a project admin can change settings at https://forge-allura.apache.org/p/allura/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
[allura:tickets] #8323 gsoc19 - Trigger notification task per each artifact creation/modification and add tests
Hi.. I am trying with following test class ~~~ class TestNotificationTasks2(TestController): def setUp(self): super(TestNotificationTasks2, self).setUp() self.setup_with_tools() @td.with_wiki def setup_with_tools(self): pass def test_send_usermentions_notification(self): c.user = M.User.by_username('test-admin') c.user.set_pref('mention_notifications', True) with mock.patch.object(M.User, 'send_user_mention_notification') as um_func: d = dict(title='foo', text='new footext') r = self.app.post('/wiki/foo/update', params=d) print r ~~~ Do you think why I am getting this 302 Found The resource was found at http://localhost/wiki/foo/; you should be redirected automatically. Thanks --- ** [tickets:#8323] gsoc19 - Trigger notification task per each artifact creation/modification and add tests** **Status:** review **Milestone:** unreleased **Labels:** gsoc19 **Created:** Mon Aug 12, 2019 04:50 PM UTC by Shalitha Suranga **Last Updated:** Mon Aug 19, 2019 05:55 PM UTC **Owner:** Shalitha Suranga Add a test for the send_usermentions_notification task. Also.. `send_usermentions_notification` task is only called in a few places so far, but would be good to do in all the places where a new artifact is created/modified(content) (new wiki page, new ticket, new blog post, new merge request). Maybe a new ticket for all that together. --- Sent from forge-allura.apache.org because dev@allura.apache.org is subscribed to https://forge-allura.apache.org/p/allura/tickets/ To unsubscribe from further messages, a project admin can change settings at https://forge-allura.apache.org/p/allura/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
[allura:tickets] #8323 gsoc19 - Trigger notification task per each artifact creation/modification and add tests
A common pattern that we use in tests is like this: ``` h.set_context('test', 'wiki', neighborhood='Projects') ``` And then can use `c.project` and `c.app` variables just like "normal" non-test code often does. `c.app` should be the wiki. Also since there is such small amount of data in tests by default, you can probably do `Page.query.find(...)` and not worry about what app it is part of. If not of that works and its not finding the project or wiki or page at all, maybe I was wrong about what the setup_basic_test function does in that test. You might need to make a separate test class that also has `setup_functional_test` in its `setUp`. That might be the thing that populates some sample data. --- ** [tickets:#8323] gsoc19 - Trigger notification task per each artifact creation/modification and add tests** **Status:** review **Milestone:** unreleased **Labels:** gsoc19 **Created:** Mon Aug 12, 2019 04:50 PM UTC by Shalitha Suranga **Last Updated:** Mon Aug 19, 2019 04:58 PM UTC **Owner:** Shalitha Suranga Add a test for the send_usermentions_notification task. Also.. `send_usermentions_notification` task is only called in a few places so far, but would be good to do in all the places where a new artifact is created/modified(content) (new wiki page, new ticket, new blog post, new merge request). Maybe a new ticket for all that together. --- Sent from forge-allura.apache.org because dev@allura.apache.org is subscribed to https://forge-allura.apache.org/p/allura/tickets/ To unsubscribe from further messages, a project admin can change settings at https://forge-allura.apache.org/p/allura/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
[allura:tickets] #8323 gsoc19 - Trigger notification task per each artifact creation/modification and add tests
Hi. @brondsem What is the correct way to create wiki instance . I tried `project = M.Project.query.get(shortname='test') wiki = project.app_instance('wiki')` but wiki is `None` always :/ Thanks --- ** [tickets:#8323] gsoc19 - Trigger notification task per each artifact creation/modification and add tests** **Status:** review **Milestone:** unreleased **Labels:** gsoc19 **Created:** Mon Aug 12, 2019 04:50 PM UTC by Shalitha Suranga **Last Updated:** Sun Aug 18, 2019 06:49 PM UTC **Owner:** Shalitha Suranga Add a test for the send_usermentions_notification task. Also.. `send_usermentions_notification` task is only called in a few places so far, but would be good to do in all the places where a new artifact is created/modified(content) (new wiki page, new ticket, new blog post, new merge request). Maybe a new ticket for all that together. --- Sent from forge-allura.apache.org because dev@allura.apache.org is subscribed to https://forge-allura.apache.org/p/allura/tickets/ To unsubscribe from further messages, a project admin can change settings at https://forge-allura.apache.org/p/allura/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
[allura:tickets] #8323 gsoc19 - Trigger notification task per each artifact creation/modification and add tests
Looking good adding a test in `TestNotificationTasks` would be good. I think with sample test data there, there should be a wiki `Page` artifact created that you could query for. Or make a new artifact of some type. And then use that to call `send_usermentions_notification` And the `mock` example you gave is good too. That way you can make assertions about what actual mails got sent out. --- ** [tickets:#8323] gsoc19 - Trigger notification task per each artifact creation/modification and add tests** **Status:** review **Milestone:** unreleased **Labels:** gsoc19 **Created:** Mon Aug 12, 2019 04:50 PM UTC by Shalitha Suranga **Last Updated:** Sun Aug 18, 2019 07:06 AM UTC **Owner:** Shalitha Suranga Add a test for the send_usermentions_notification task. Also.. `send_usermentions_notification` task is only called in a few places so far, but would be good to do in all the places where a new artifact is created/modified(content) (new wiki page, new ticket, new blog post, new merge request). Maybe a new ticket for all that together. --- Sent from forge-allura.apache.org because dev@allura.apache.org is subscribed to https://forge-allura.apache.org/p/allura/tickets/ To unsubscribe from further messages, a project admin can change settings at https://forge-allura.apache.org/p/allura/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
[allura:tickets] #8323 gsoc19 - Trigger notification task per each artifact creation/modification and add tests
- **status**: open --> review --- ** [tickets:#8323] gsoc19 - Trigger notification task per each artifact creation/modification and add tests** **Status:** review **Milestone:** unreleased **Labels:** gsoc19 **Created:** Mon Aug 12, 2019 04:50 PM UTC by Shalitha Suranga **Last Updated:** Sat Aug 17, 2019 04:20 PM UTC **Owner:** Shalitha Suranga Add a test for the send_usermentions_notification task. Also.. `send_usermentions_notification` task is only called in a few places so far, but would be good to do in all the places where a new artifact is created/modified(content) (new wiki page, new ticket, new blog post, new merge request). Maybe a new ticket for all that together. --- Sent from forge-allura.apache.org because dev@allura.apache.org is subscribed to https://forge-allura.apache.org/p/allura/tickets/ To unsubscribe from further messages, a project admin can change settings at https://forge-allura.apache.org/p/allura/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
[allura:tickets] #8323 gsoc19 - Trigger notification task per each artifact creation/modification and add tests
Hi.. I've updated the task calls and pushed to ss/8323. Btw as you mentioned there needs to be some test coverage So we can add a test to `TestNotificationTasks.test_send_usermentions_notification` ? We can use `with mock.patch.object(mail_tasks.smtp_client, '_client') as _client:` as in mail tasks I guess. Could you advice your points about test coverage Thanks --- ** [tickets:#8323] gsoc19 - Trigger notification task per each artifact creation/modification and add tests** **Status:** open **Milestone:** unreleased **Labels:** gsoc19 **Created:** Mon Aug 12, 2019 04:50 PM UTC by Shalitha Suranga **Last Updated:** Wed Aug 14, 2019 07:14 PM UTC **Owner:** Shalitha Suranga Add a test for the send_usermentions_notification task. Also.. `send_usermentions_notification` task is only called in a few places so far, but would be good to do in all the places where a new artifact is created/modified(content) (new wiki page, new ticket, new blog post, new merge request). Maybe a new ticket for all that together. --- Sent from forge-allura.apache.org because dev@allura.apache.org is subscribed to https://forge-allura.apache.org/p/allura/tickets/ To unsubscribe from further messages, a project admin can change settings at https://forge-allura.apache.org/p/allura/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
[allura:tickets] #8323 gsoc19 - Trigger notification task per each artifact creation/modification and add tests
Hey.. @brondsem When I used `.post` there there is an error from `bsoc` Here is the error : https://drive.google.com/file/d/1uoAUEUUJJOkRVCA3sL9-KThHSMNVDTgf/view?usp=sharing Could you please help to figure out the issue Thanks --- ** [tickets:#8323] gsoc19 - Trigger notification task per each artifact creation/modification and add tests** **Status:** open **Milestone:** unreleased **Labels:** gsoc19 **Created:** Mon Aug 12, 2019 04:50 PM UTC by Shalitha Suranga **Last Updated:** Tue Aug 13, 2019 09:40 PM UTC **Owner:** Shalitha Suranga Add a test for the send_usermentions_notification task. Also.. `send_usermentions_notification` task is only called in a few places so far, but would be good to do in all the places where a new artifact is created/modified(content) (new wiki page, new ticket, new blog post, new merge request). Maybe a new ticket for all that together. --- Sent from forge-allura.apache.org because dev@allura.apache.org is subscribed to https://forge-allura.apache.org/p/allura/tickets/ To unsubscribe from further messages, a project admin can change settings at https://forge-allura.apache.org/p/allura/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
[allura:tickets] #8323 gsoc19 - Trigger notification task per each artifact creation/modification and add tests
I didn't notice this earlier, but all `send_usermentions_notification` usage should be like `send_usermentions_notification.post(...)` The `post` is a method automatically added by the `@task` decorator, and calling `post(...)` makes it run via the background task queue instead of being run directly as a regular function. --- ** [tickets:#8323] gsoc19 - Trigger notification task per each artifact creation/modification and add tests** **Status:** open **Milestone:** unreleased **Labels:** gsoc19 **Created:** Mon Aug 12, 2019 04:50 PM UTC by Shalitha Suranga **Last Updated:** Tue Aug 13, 2019 04:30 PM UTC **Owner:** Shalitha Suranga Add a test for the send_usermentions_notification task. Also.. `send_usermentions_notification` task is only called in a few places so far, but would be good to do in all the places where a new artifact is created/modified(content) (new wiki page, new ticket, new blog post, new merge request). Maybe a new ticket for all that together. --- Sent from forge-allura.apache.org because dev@allura.apache.org is subscribed to https://forge-allura.apache.org/p/allura/tickets/ To unsubscribe from further messages, a project admin can change settings at https://forge-allura.apache.org/p/allura/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
[allura:tickets] #8323 gsoc19 - Trigger notification task per each artifact creation/modification and add tests
Hi.. Added task call to above artifact create/update at ss/8323 Thanks --- ** [tickets:#8323] gsoc19 - Trigger notification task per each artifact creation/modification and add tests** **Status:** open **Milestone:** unreleased **Labels:** gsoc19 **Created:** Mon Aug 12, 2019 04:50 PM UTC by Shalitha Suranga **Last Updated:** Mon Aug 12, 2019 05:24 PM UTC **Owner:** Shalitha Suranga Add a test for the send_usermentions_notification task. Also.. `send_usermentions_notification` task is only called in a few places so far, but would be good to do in all the places where a new artifact is created/modified(content) (new wiki page, new ticket, new blog post, new merge request). Maybe a new ticket for all that together. --- Sent from forge-allura.apache.org because dev@allura.apache.org is subscribed to https://forge-allura.apache.org/p/allura/tickets/ To unsubscribe from further messages, a project admin can change settings at https://forge-allura.apache.org/p/allura/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
[allura:tickets] #8323 gsoc19 - Trigger notification task per each artifact creation/modification and add tests
Currently task call is added to ticket, wiki artifacts in ss/8323 --- ** [tickets:#8323] gsoc19 - Trigger notification task per each artifact creation/modification and add tests** **Status:** open **Milestone:** unreleased **Labels:** gsoc19 **Created:** Mon Aug 12, 2019 04:50 PM UTC by Shalitha Suranga **Last Updated:** Mon Aug 12, 2019 04:53 PM UTC **Owner:** Shalitha Suranga Add a test for the send_usermentions_notification task. Also.. `send_usermentions_notification` task is only called in a few places so far, but would be good to do in all the places where a new artifact is created/modified(content) (new wiki page, new ticket, new blog post, new merge request). Maybe a new ticket for all that together. --- Sent from forge-allura.apache.org because dev@allura.apache.org is subscribed to https://forge-allura.apache.org/p/allura/tickets/ To unsubscribe from further messages, a project admin can change settings at https://forge-allura.apache.org/p/allura/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
[allura:tickets] #8323 gsoc19 - Trigger notification task per each artifact creation/modification and add tests
Hi.. @brondsem Created a new ticket for finalizing new feature and regarding adding missing tests, and support for other artifacts. Note: There are 2 follow up works also --- ** [tickets:#8323] gsoc19 - Trigger notification task per each artifact creation/modification and add tests** **Status:** open **Milestone:** unreleased **Labels:** gsoc19 **Created:** Mon Aug 12, 2019 04:50 PM UTC by Shalitha Suranga **Last Updated:** Mon Aug 12, 2019 04:50 PM UTC **Owner:** Shalitha Suranga Add a test for the send_usermentions_notification task. Also.. `send_usermentions_notification` task is only called in a few places so far, but would be good to do in all the places where a new artifact is created/modified(content) (new wiki page, new ticket, new blog post, new merge request). Maybe a new ticket for all that together. --- Sent from forge-allura.apache.org because dev@allura.apache.org is subscribed to https://forge-allura.apache.org/p/allura/tickets/ To unsubscribe from further messages, a project admin can change settings at https://forge-allura.apache.org/p/allura/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
[allura:tickets] #8323 gsoc19 - Trigger notification task per each artifact creation/modification and add tests
--- ** [tickets:#8323] gsoc19 - Trigger notification task per each artifact creation/modification and add tests** **Status:** open **Milestone:** unreleased **Labels:** gsoc19 **Created:** Mon Aug 12, 2019 04:50 PM UTC by Shalitha Suranga **Last Updated:** Mon Aug 12, 2019 04:50 PM UTC **Owner:** Shalitha Suranga Add a test for the send_usermentions_notification task. Also.. `send_usermentions_notification` task is only called in a few places so far, but would be good to do in all the places where a new artifact is created/modified(content) (new wiki page, new ticket, new blog post, new merge request). Maybe a new ticket for all that together. --- Sent from forge-allura.apache.org because dev@allura.apache.org is subscribed to https://forge-allura.apache.org/p/allura/tickets/ To unsubscribe from further messages, a project admin can change settings at https://forge-allura.apache.org/p/allura/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.