def test_staff_can_filter_webhook_by_author_uuid(self): WebHookFactory(user=self.author) WebHookFactory(user=self.other_user) self.client.force_authenticate(user=self.staff) response = self.client.get(WebHookFactory.get_list_url(), {'author_uuid': self.author.uuid.hex}) self.assertEqual(response.status_code, status.HTTP_200_OK, response.data) self.assertEqual(len(response.data), 1) self.assertEqual(self.author.uuid, response.data[0]['author_uuid'])
def test_staff_can_filter_summary_hook_by_author_uuid(self): WebHookFactory(user=self.author) WebHookFactory(user=self.other_user) self.client.force_authenticate(user=self.staff) response = self.client.get( reverse('hooks-list'), {'author_uuid': self.author.uuid.hex} ) self.assertEqual(response.status_code, status.HTTP_200_OK, response.data) self.assertEqual(len(response.data), 1) self.assertEqual(str(self.author.uuid), str(response.data[0]['author_uuid']))
def test_user_can_create_webhook(self): self.client.force_authenticate(user=self.author) response = self.client.post(WebHookFactory.get_list_url(), data={ 'event_types': self.valid_event_types, 'destination_url': 'http://example.com/' }) self.assertEqual(response.status_code, status.HTTP_201_CREATED, response.data)
def test_user_can_subscribe_to_event_groups(self): event_groups = self.valid_event_groups event_types = loggers.expand_event_groups(event_groups) self.client.force_authenticate(user=self.author) response = self.client.post(WebHookFactory.get_list_url(), data={ 'event_groups': event_groups, 'destination_url': 'http://example.com/' }) self.assertEqual(response.status_code, status.HTTP_201_CREATED) self.assertEqual(response.data['event_groups'], set(event_groups)) self.assertEqual(response.data['event_types'], set(event_types))
def setUp(self): super(HookUpdateTest, self).setUp() self.hooks = { 'web': WebHookFactory.get_url(WebHookFactory(user=self.author)), 'push': PushHookFactory.get_url(PushHookFactory(user=self.author)), }
def setUp(self): super(HookPermissionsViewTest, self).setUp() self.url = WebHookFactory.get_url(WebHookFactory(user=self.author))