Пример #1
0
 def test_reply(self, mock_support):
     """Given a message, a support notification should be sent to the task's user."""
     # pylint: disable=no-self-use
     flagged_task = FlaggedTaskFactory()
     reply = 'Lorem ipsum'
     flagged_task.reply(reply)
     mock_support.assert_called_with(flagged_task.user, reply, flagged_task)
Пример #2
0
 def test_reply(self, mock_support):
     """Given a message, a support notification should be sent to the task's user."""
     flagged_task = FlaggedTaskFactory()
     reply = "Lorem ipsum"
     flagged_task.reply(reply)
     mock_support.assert_called_with(flagged_task.user.pk, reply,
                                     flagged_task.pk)
Пример #3
0
 def setUp(self):
     password = "******"
     self.user = UserFactory(is_staff=True, password=password)
     self.url = reverse("flagged-task-list")
     self.view = FlaggedTaskList.as_view()
     self.task = FlaggedTaskFactory()
     self.request_factory = RequestFactory()
     self.client.login(username=self.user.username, password=password)
Пример #4
0
 def setUp(self):
     AgencyFactory()
     ArticleFactory()
     CrowdsourceResponseFactory()
     FOIARequestFactory()
     FlaggedTaskFactory()
     NewAgencyTaskFactory()
     OrphanTaskFactory()
     QuestionFactory()
     ResponseTaskFactory()
     SnailMailTaskFactory()
     UserFactory()
Пример #5
0
 def test_create_zend_ticket(self, mock_requests):
     """Test the creation of a zendesk help ticket when a flag is created"""
     mock_requests.post(
         "https://muckrock.zendesk.com/api/v2/requests.json",
         json={"request": {
             "id": "ticket_id"
         }},
     )
     flagged_task = FlaggedTaskFactory(user__email="*****@*****.**",
                                       text="Example flag text")
     flagged_task.refresh_from_db()
     ok_(flagged_task.resolved)
     eq_(flagged_task.form_data, {"zen_id": "ticket_id"})
Пример #6
0
 def test_create_zoho_ticket(self, mock_requests):
     """Test the creation of a zoho help ticket when a flag is created"""
     mock_requests.get(
         settings.ZOHO_URL + "contacts/search",
         json={
             "count": 1,
             "data": [{
                 "id": "contact_id"
             }]
         },
     )
     mock_requests.post(settings.ZOHO_URL + "tickets",
                        json={"id": "ticket_id"})
     flagged_task = FlaggedTaskFactory(user__email="*****@*****.**",
                                       text="Example flag text")
     flagged_task.refresh_from_db()
     ok_(flagged_task.resolved)
     eq_(flagged_task.form_data, {"zoho_id": "ticket_id"})
Пример #7
0
 def test_create_zoho_ticket(self, mock_requests):
     """Test the creation of a zoho help ticket when a flag is created"""
     mock_requests.get(
         settings.ZOHO_URL + 'contacts/search',
         json={
             'count': 1,
             'data': [{
                 'id': 'contact_id'
             }]
         },
     )
     mock_requests.post(
         settings.ZOHO_URL + 'tickets',
         json={'id': 'ticket_id'},
     )
     flagged_task = FlaggedTaskFactory(
         user__email='*****@*****.**',
         text='Example flag text',
     )
     flagged_task.refresh_from_db()
     ok_(flagged_task.resolved)
     eq_(flagged_task.form_data, {'zoho_id': 'ticket_id'})
Пример #8
0
 def test_support(self, mock_send):
     """Notifies the user with a support response."""
     task = FlaggedTaskFactory()
     tasks.support(self.user, 'Hello', task)
     mock_send.assert_called_with(fail_silently=False)
Пример #9
0
 def setUp(self):
     self.user = factories.UserFactory(is_staff=True)
     self.url = reverse('flagged-task-list')
     self.view = task.views.FlaggedTaskList.as_view()
     self.task = FlaggedTaskFactory()
     self.request_factory = RequestFactory()