mirror of https://github.com/zulip/zulip.git
python: Sort webhooks imports with isort.
This commit is contained in:
parent
8e7ce7cc79
commit
c10cc24ee8
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class AirbrakeHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'airbrake'
|
||||
URL_TEMPLATE = u"/api/v1/external/airbrake?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -4,9 +4,9 @@ from typing import Any, Dict
|
|||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
AIRBRAKE_TOPIC_TEMPLATE = '{project_name}'
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class AnsibletowerHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'ansibletower'
|
||||
URL_TEMPLATE = "/api/v1/external/ansibletower?api_key={api_key}&stream={stream}"
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import operator
|
||||
from typing import Any, Dict, List
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.decorator import REQ, api_key_only_webhook_view, \
|
||||
has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.decorator import REQ, has_request_variables, api_key_only_webhook_view
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
import operator
|
||||
|
||||
ANSIBLETOWER_DEFAULT_MESSAGE_TEMPLATE = "{friendly_name}: [#{id} {name}]({url}) {status}."
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
from zerver.webhooks.appfollow.view import convert_markdown
|
||||
|
||||
|
||||
class AppFollowHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'appfollow'
|
||||
URL_TEMPLATE = u"/api/v1/external/appfollow?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -10,6 +10,7 @@ from zerver.lib.response import json_success
|
|||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
|
||||
@api_key_only_webhook_view("AppFollow")
|
||||
@has_request_variables
|
||||
def api_appfollow_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class AppveyorHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'appveyor'
|
||||
URL_TEMPLATE = "/api/v1/external/appveyor?api_key={api_key}&stream={stream}"
|
||||
|
|
|
@ -2,9 +2,10 @@ from typing import Any, Dict
|
|||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.decorator import REQ, api_key_only_webhook_view, \
|
||||
has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.decorator import REQ, has_request_variables, api_key_only_webhook_view
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
APPVEYOR_TOPIC_TEMPLATE = '{project_name}'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class BasecampHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'basecamp'
|
||||
URL_TEMPLATE = u"/api/v1/external/basecamp?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -7,8 +7,8 @@ from django.http import HttpRequest, HttpResponse
|
|||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message, \
|
||||
UnexpectedWebhookEventType
|
||||
from zerver.lib.webhooks.common import UnexpectedWebhookEventType, \
|
||||
check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
from .support_event import SUPPORT_EVENTS
|
||||
|
|
|
@ -6,6 +6,7 @@ from mock import MagicMock, patch
|
|||
from zerver.lib.test_classes import WebhookTestCase
|
||||
from zerver.lib.webhooks.git import COMMITS_LIMIT
|
||||
|
||||
|
||||
class BeanstalkHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'commits'
|
||||
URL_TEMPLATE = u"/api/v1/external/beanstalk?stream={stream}"
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
# Webhooks for external integrations.
|
||||
|
||||
import base64
|
||||
from functools import wraps
|
||||
from typing import Any, Dict, Optional, List, Tuple
|
||||
import re
|
||||
from functools import wraps
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import authenticated_rest_api_view
|
||||
from zerver.lib.types import ViewFuncT
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.types import ViewFuncT
|
||||
from zerver.lib.validator import check_dict
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.lib.webhooks.git import TOPIC_WITH_BRANCH_TEMPLATE, \
|
||||
get_push_commits_event_message
|
||||
from zerver.lib.validator import check_dict
|
||||
from zerver.models import UserProfile
|
||||
|
||||
|
||||
def build_message_from_gitlog(user_profile: UserProfile, name: str, ref: str,
|
||||
commits: List[Dict[str, str]], before: str, after: str,
|
||||
url: str, pusher: str, forced: Optional[str]=None,
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from unittest.mock import patch
|
||||
from typing import Any
|
||||
from unittest.mock import patch
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class BeeminderHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'beeminder'
|
||||
URL_TEMPLATE = u"/api/v1/external/beeminder?api_key={api_key}&stream={stream}"
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
# Webhooks for external integrations.
|
||||
from typing import Dict, Any
|
||||
import time
|
||||
from typing import Any, Dict
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
import time
|
||||
|
||||
MESSAGE_TEMPLATE = ("You are going to derail from goal **{goal_name}** in **{time:0.1f} hours**. "
|
||||
"You need **{limsum}** to avoid derailing.\n"
|
||||
|
|
|
@ -5,6 +5,7 @@ from mock import MagicMock, patch
|
|||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class BitbucketHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'bitbucket'
|
||||
URL_TEMPLATE = "/api/v1/external/bitbucket?stream={stream}"
|
||||
|
|
|
@ -11,6 +11,7 @@ from zerver.lib.webhooks.git import TOPIC_WITH_BRANCH_TEMPLATE, \
|
|||
get_push_commits_event_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
|
||||
@authenticated_rest_api_view(webhook_client_name="Bitbucket")
|
||||
@has_request_variables
|
||||
def api_bitbucket_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||
|
|
|
@ -3,6 +3,7 @@ from mock import MagicMock, patch
|
|||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class Bitbucket2HookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'bitbucket2'
|
||||
URL_TEMPLATE = "/api/v1/external/bitbucket2?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -1,23 +1,22 @@
|
|||
# Webhooks for external integrations.
|
||||
import re
|
||||
from functools import partial
|
||||
import string
|
||||
from typing import Any, Dict, List, Optional
|
||||
from functools import partial
|
||||
from inspect import signature
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message, \
|
||||
validate_extract_webhook_http_header, UnexpectedWebhookEventType
|
||||
from zerver.lib.webhooks.common import UnexpectedWebhookEventType, \
|
||||
check_send_webhook_message, validate_extract_webhook_http_header
|
||||
from zerver.lib.webhooks.git import TOPIC_WITH_BRANCH_TEMPLATE, \
|
||||
TOPIC_WITH_PR_OR_ISSUE_INFO_TEMPLATE, \
|
||||
get_commits_comment_action_message, get_force_push_commits_event_message, \
|
||||
get_issue_event_message, get_pull_request_event_message, \
|
||||
get_push_commits_event_message, get_push_tag_event_message, \
|
||||
get_remove_branch_event_message
|
||||
TOPIC_WITH_PR_OR_ISSUE_INFO_TEMPLATE, get_commits_comment_action_message, \
|
||||
get_force_push_commits_event_message, get_issue_event_message, \
|
||||
get_pull_request_event_message, get_push_commits_event_message, \
|
||||
get_push_tag_event_message, get_remove_branch_event_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
BITBUCKET_TOPIC_TEMPLATE = '{repository_name}'
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class Bitbucket3HookTests(WebhookTestCase):
|
||||
STREAM_NAME = "bitbucket3"
|
||||
URL_TEMPLATE = "/api/v1/external/bitbucket3?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
from inspect import signature
|
||||
from functools import partial
|
||||
import string
|
||||
from typing import Any, Dict, Optional, List, Callable
|
||||
from functools import partial
|
||||
from inspect import signature
|
||||
from typing import Any, Callable, Dict, List, Optional
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.models import UserProfile
|
||||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.git import TOPIC_WITH_BRANCH_TEMPLATE, \
|
||||
get_push_tag_event_message, get_remove_branch_event_message, \
|
||||
get_create_branch_event_message, get_commits_comment_action_message, \
|
||||
TOPIC_WITH_PR_OR_ISSUE_INFO_TEMPLATE, get_pull_request_event_message, \
|
||||
CONTENT_MESSAGE_TEMPLATE
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message, \
|
||||
UnexpectedWebhookEventType
|
||||
from zerver.webhooks.bitbucket2.view import BITBUCKET_TOPIC_TEMPLATE, \
|
||||
BITBUCKET_FORK_BODY, BITBUCKET_REPO_UPDATED_CHANGED
|
||||
from zerver.lib.webhooks.common import UnexpectedWebhookEventType, \
|
||||
check_send_webhook_message
|
||||
from zerver.lib.webhooks.git import CONTENT_MESSAGE_TEMPLATE, \
|
||||
TOPIC_WITH_BRANCH_TEMPLATE, TOPIC_WITH_PR_OR_ISSUE_INFO_TEMPLATE, \
|
||||
get_commits_comment_action_message, get_create_branch_event_message, \
|
||||
get_pull_request_event_message, get_push_tag_event_message, \
|
||||
get_remove_branch_event_message
|
||||
from zerver.models import UserProfile
|
||||
from zerver.webhooks.bitbucket2.view import BITBUCKET_FORK_BODY, \
|
||||
BITBUCKET_REPO_UPDATED_CHANGED, BITBUCKET_TOPIC_TEMPLATE
|
||||
|
||||
BRANCH_UPDATED_MESSAGE_TEMPLATE = "{user_name} pushed to branch {branch_name}. Head is now {head}."
|
||||
PULL_REQUEST_MARKED_AS_NEEDS_WORK_TEMPLATE = "{user_name} marked [PR #{number}]({url}) as \"needs work\"."
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class BuildbotHookTests(WebhookTestCase):
|
||||
STREAM_NAME = "buildbot"
|
||||
URL_TEMPLATE = u"/api/v1/external/buildbot?api_key={api_key}&stream={stream}"
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
from typing import Dict, Any
|
||||
from typing import Any, Dict
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.models import UserProfile
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
|
||||
@api_key_only_webhook_view('Buildbot')
|
||||
@has_request_variables
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class CircleCiHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'circleci'
|
||||
URL_TEMPLATE = u"/api/v1/external/circleci?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Webhooks for external integrations.
|
||||
|
||||
from typing import Any, Dict
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import json
|
||||
|
||||
from mock import MagicMock, patch
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class ClubhouseWebhookTest(WebhookTestCase):
|
||||
STREAM_NAME = 'clubhouse'
|
||||
URL_TEMPLATE = "/api/v1/external/clubhouse?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -4,13 +4,12 @@ from typing import Any, Dict, Optional
|
|||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message, \
|
||||
UnexpectedWebhookEventType
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import UnexpectedWebhookEventType, \
|
||||
check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
|
||||
EPIC_NAME_TEMPLATE = "**{name}**"
|
||||
STORY_NAME_TEMPLATE = "[{name}]({app_url})"
|
||||
COMMENT_ADDED_TEMPLATE = "New comment added to the {entity} {name_template}:\n``` quote\n{text}\n```"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class CodeshipHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'codeship'
|
||||
URL_TEMPLATE = u"/api/v1/external/codeship?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Webhooks for external integrations.
|
||||
|
||||
from typing import Any, Dict
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class CrashlyticsHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'crashlytics'
|
||||
URL_TEMPLATE = u"/api/v1/external/crashlytics?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class DelightedHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'delighted'
|
||||
URL_TEMPLATE = "/api/v1/external/delighted?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
# Tests for the Desk.com webhook integration.
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Webhooks for external integrations.
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import authenticated_rest_api_view
|
||||
|
@ -8,6 +7,7 @@ from zerver.lib.response import json_success
|
|||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
|
||||
# Desk.com's integrations all make the user supply a template, where it fills
|
||||
# in stuff like {{customer.name}} and posts the result as a "data" parameter.
|
||||
# There's no raw JSON for us to work from. Thus, it makes sense to just write
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class DialogflowHookTests(WebhookTestCase):
|
||||
URL_TEMPLATE = u"/api/v1/external/dialogflow?api_key={api_key}&email=AARON@zulip.com"
|
||||
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
# Webhooks for external integrations.
|
||||
from typing import Any, Dict
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.actions import check_send_private_message
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.models import UserProfile, get_user_profile_by_email
|
||||
|
||||
|
||||
@api_key_only_webhook_view("dialogflow")
|
||||
@has_request_variables
|
||||
def api_dialogflow_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
from zerver.lib.users import get_api_key
|
||||
|
||||
|
||||
class DropboxHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'test'
|
||||
URL_TEMPLATE = "/api/v1/external/dropbox?&api_key={api_key}&stream={stream}"
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import api_key_only_webhook_view, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.decorator import has_request_variables, api_key_only_webhook_view
|
||||
from zerver.models import UserProfile
|
||||
|
||||
|
||||
@api_key_only_webhook_view('Dropbox', notify_bot_owner_on_invalid_json=False)
|
||||
@has_request_variables
|
||||
def api_dropbox_webhook(request: HttpRequest, user_profile: UserProfile) -> HttpResponse:
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class FlockHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'test'
|
||||
URL_TEMPLATE = u"/api/v1/external/flock?api_key={api_key}&stream={stream}"
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
# Webhooks for external integrations.
|
||||
from typing import Any, Dict
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import REQ, api_key_only_webhook_view, \
|
||||
has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.decorator import REQ, has_request_variables, api_key_only_webhook_view
|
||||
from zerver.models import UserProfile
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
from typing import Dict, Any
|
||||
|
||||
CHECK_IS_REPLY = "in reply to"
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from mock import MagicMock, patch
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class FreshdeskHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'freshdesk'
|
||||
URL_TEMPLATE = u"/api/v1/external/freshdesk?stream={stream}"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
"""Webhooks for external integrations."""
|
||||
|
||||
import logging
|
||||
from typing import Any, Dict, List
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ import ujson
|
|||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class FrontHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'front'
|
||||
URL_TEMPLATE = "/api/v1/external/front?&api_key={api_key}&stream={stream}"
|
||||
|
|
|
@ -9,6 +9,7 @@ from zerver.lib.response import json_error, json_success
|
|||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
|
||||
def get_message_data(payload: Dict[str, Any]) -> Tuple[str, str, str, str]:
|
||||
link = "https://app.frontapp.com/open/" + payload['target']['data']['id']
|
||||
outbox = payload['conversation']['recipient']['handle']
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class GoogleCodeInTests(WebhookTestCase):
|
||||
STREAM_NAME = 'gci'
|
||||
URL_TEMPLATE = "/api/v1/external/gci?&api_key={api_key}&stream={stream}"
|
||||
|
|
|
@ -3,6 +3,7 @@ from mock import MagicMock, patch
|
|||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class GiteaHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'commits'
|
||||
URL_TEMPLATE = "/api/v1/external/giteae?&api_key={api_key}&stream={stream}"
|
||||
|
|
|
@ -12,7 +12,6 @@ from zerver.models import UserProfile
|
|||
# Gitea is a fork of Gogs, and so the webhook implementation is nearly the same.
|
||||
from zerver.webhooks.gogs.view import gogs_webhook_main
|
||||
|
||||
|
||||
fixture_to_headers = get_http_headers_from_filename("HTTP_X_GITEA_EVENT")
|
||||
|
||||
def format_pull_request_event(payload: Dict[str, Any],
|
||||
|
|
|
@ -3,6 +3,7 @@ from mock import MagicMock, patch
|
|||
from zerver.lib.test_classes import WebhookTestCase
|
||||
from zerver.lib.webhooks.git import COMMITS_LIMIT
|
||||
|
||||
|
||||
class GithubWebhookTest(WebhookTestCase):
|
||||
STREAM_NAME = 'github'
|
||||
URL_TEMPLATE = "/api/v1/external/github?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -1,23 +1,22 @@
|
|||
import re
|
||||
from functools import partial
|
||||
from typing import Any, Dict, Optional
|
||||
from inspect import signature
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message, \
|
||||
validate_extract_webhook_http_header, UnexpectedWebhookEventType
|
||||
from zerver.lib.webhooks.common import UnexpectedWebhookEventType, \
|
||||
check_send_webhook_message, get_http_headers_from_filename, \
|
||||
validate_extract_webhook_http_header
|
||||
from zerver.lib.webhooks.git import CONTENT_MESSAGE_TEMPLATE, \
|
||||
TOPIC_WITH_BRANCH_TEMPLATE, TOPIC_WITH_PR_OR_ISSUE_INFO_TEMPLATE, \
|
||||
get_commits_comment_action_message, get_issue_event_message, \
|
||||
get_pull_request_event_message, get_push_commits_event_message, \
|
||||
get_push_tag_event_message, get_setup_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
from zerver.lib.webhooks.common import \
|
||||
get_http_headers_from_filename
|
||||
|
||||
fixture_to_headers = get_http_headers_from_filename("HTTP_X_GITHUB_EVENT")
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ from mock import MagicMock, patch
|
|||
from zerver.lib.test_classes import WebhookTestCase
|
||||
from zerver.lib.webhooks.git import COMMITS_LIMIT
|
||||
|
||||
|
||||
class GitlabHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'gitlab'
|
||||
URL_TEMPLATE = "/api/v1/external/gitlab?&api_key={api_key}&stream={stream}"
|
||||
|
|
|
@ -1,22 +1,23 @@
|
|||
from functools import partial
|
||||
from typing import Any, Dict, Optional
|
||||
from inspect import signature
|
||||
import re
|
||||
from functools import partial
|
||||
from inspect import signature
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message, \
|
||||
validate_extract_webhook_http_header, UnexpectedWebhookEventType
|
||||
from zerver.lib.webhooks.common import UnexpectedWebhookEventType, \
|
||||
check_send_webhook_message, validate_extract_webhook_http_header
|
||||
from zerver.lib.webhooks.git import EMPTY_SHA, \
|
||||
TOPIC_WITH_PR_OR_ISSUE_INFO_TEMPLATE, \
|
||||
get_commits_comment_action_message, get_issue_event_message, \
|
||||
get_pull_request_event_message, get_push_commits_event_message, \
|
||||
get_push_tag_event_message, get_remove_branch_event_message
|
||||
TOPIC_WITH_PR_OR_ISSUE_INFO_TEMPLATE, get_commits_comment_action_message, \
|
||||
get_issue_event_message, get_pull_request_event_message, \
|
||||
get_push_commits_event_message, get_push_tag_event_message, \
|
||||
get_remove_branch_event_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
|
||||
def fixture_to_headers(fixture_name: str) -> Dict[str, Any]:
|
||||
if fixture_name.startswith("build"):
|
||||
return {} # Since there are 2 possible event types.
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class GocdHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'gocd'
|
||||
URL_TEMPLATE = "/api/v1/external/gocd?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
# Webhooks for external integrations.
|
||||
|
||||
import json
|
||||
import os
|
||||
|
||||
from typing import Any, Dict
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
|
|
@ -4,6 +4,7 @@ from mock import MagicMock, patch
|
|||
from zerver.lib.test_classes import WebhookTestCase
|
||||
from zerver.lib.webhooks.git import COMMITS_LIMIT
|
||||
|
||||
|
||||
class GogsHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'commits'
|
||||
URL_TEMPLATE = "/api/v1/external/gogs?&api_key={api_key}&stream={stream}"
|
||||
|
|
|
@ -7,13 +7,13 @@ from django.http import HttpRequest, HttpResponse
|
|||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message, \
|
||||
validate_extract_webhook_http_header, UnexpectedWebhookEventType, \
|
||||
get_http_headers_from_filename
|
||||
from zerver.lib.webhooks.common import UnexpectedWebhookEventType, \
|
||||
check_send_webhook_message, get_http_headers_from_filename, \
|
||||
validate_extract_webhook_http_header
|
||||
from zerver.lib.webhooks.git import TOPIC_WITH_BRANCH_TEMPLATE, \
|
||||
TOPIC_WITH_PR_OR_ISSUE_INFO_TEMPLATE, get_create_branch_event_message, \
|
||||
get_pull_request_event_message, get_push_commits_event_message, \
|
||||
get_issue_event_message
|
||||
get_issue_event_message, get_pull_request_event_message, \
|
||||
get_push_commits_event_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
fixture_to_headers = get_http_headers_from_filename("HTTP_X_GOGS_EVENT")
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
from zerver.webhooks.gosquared.view import CHAT_MESSAGE_TEMPLATE
|
||||
|
||||
|
||||
class GoSquaredHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'gosquared'
|
||||
URL_TEMPLATE = "/api/v1/external/gosquared?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -5,8 +5,8 @@ from django.http import HttpRequest, HttpResponse
|
|||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message, \
|
||||
UnexpectedWebhookEventType
|
||||
from zerver.lib.webhooks.common import UnexpectedWebhookEventType, \
|
||||
check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
TRAFFIC_SPIKE_TEMPLATE = '[{website_name}]({website_url}) has {user_num} visitors online.'
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from mock import MagicMock, patch
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class GreenhouseHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'greenhouse'
|
||||
URL_TEMPLATE = "/api/v1/external/greenhouse?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class GrooveHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'groove'
|
||||
URL_TEMPLATE = '/api/v1/external/groove?stream={stream}&api_key={api_key}'
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
# Webhooks for external integrations.
|
||||
from functools import partial
|
||||
from typing import Any, Dict, Optional, Callable
|
||||
from typing import Any, Callable, Dict, Optional
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message, \
|
||||
validate_extract_webhook_http_header, UnexpectedWebhookEventType, \
|
||||
get_http_headers_from_filename
|
||||
from zerver.lib.webhooks.common import UnexpectedWebhookEventType, \
|
||||
check_send_webhook_message, get_http_headers_from_filename, \
|
||||
validate_extract_webhook_http_header
|
||||
from zerver.models import UserProfile
|
||||
|
||||
TICKET_STARTED_TEMPLATE = """
|
||||
|
|
|
@ -3,6 +3,7 @@ from mock import MagicMock, patch
|
|||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class HarborHookTests(WebhookTestCase):
|
||||
STREAM_NAME = "harbor"
|
||||
URL_TEMPLATE = u"/api/v1/external/harbor?api_key={api_key}&stream={stream}"
|
||||
|
|
|
@ -7,8 +7,8 @@ from django.http import HttpRequest, HttpResponse
|
|||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message, \
|
||||
UnexpectedWebhookEventType
|
||||
from zerver.lib.webhooks.common import UnexpectedWebhookEventType, \
|
||||
check_send_webhook_message
|
||||
from zerver.models import Realm, UserProfile
|
||||
|
||||
IGNORED_EVENTS = [
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class HelloSignHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'hellosign'
|
||||
URL_TEMPLATE = "/api/v1/external/hellosign?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -8,7 +8,6 @@ from zerver.lib.response import json_success
|
|||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
|
||||
IS_AWAITING_SIGNATURE = "is awaiting the signature of {awaiting_recipients}"
|
||||
WAS_JUST_SIGNED_BY = "was just signed by {signed_recipients}"
|
||||
BODY = "The `{contract_title}` document {actions}."
|
||||
|
|
|
@ -4,6 +4,7 @@ from django.conf import settings
|
|||
from zerver.lib.test_classes import WebhookTestCase
|
||||
from zerver.models import get_system_bot
|
||||
|
||||
|
||||
class HelloWorldHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'test'
|
||||
URL_TEMPLATE = "/api/v1/external/helloworld?&api_key={api_key}&stream={stream}"
|
||||
|
|
|
@ -4,11 +4,12 @@ from typing import Any, Dict, Iterable
|
|||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
|
||||
@api_key_only_webhook_view('HelloWorld')
|
||||
@has_request_variables
|
||||
def api_helloworld_webhook(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class HerokuHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'heroku'
|
||||
URL_TEMPLATE = u"/api/v1/external/heroku?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Webhooks for external integrations.
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import api_key_only_webhook_view
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class HomeAssistantHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'homeassistant'
|
||||
URL_TEMPLATE = "/api/v1/external/homeassistant?&api_key={api_key}&stream={stream}"
|
||||
|
|
|
@ -8,6 +8,7 @@ from zerver.lib.response import json_success
|
|||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
|
||||
@api_key_only_webhook_view('HomeAssistant')
|
||||
@has_request_variables
|
||||
def api_homeassistant_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class IFTTTHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'ifttt'
|
||||
URL_TEMPLATE = "/api/v1/external/ifttt?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -9,6 +9,7 @@ from zerver.lib.response import json_error, json_success
|
|||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
|
||||
@api_key_only_webhook_view('IFTTT')
|
||||
@has_request_variables
|
||||
def api_iftt_app_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.decorator import REQ, has_request_variables, \
|
||||
api_key_only_webhook_view
|
||||
|
||||
from zerver.models import UserProfile
|
||||
import time
|
||||
from typing import Any, Dict
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
from typing import Dict, Any
|
||||
|
||||
import time
|
||||
from zerver.decorator import REQ, api_key_only_webhook_view, \
|
||||
has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
MESSAGE_TEMPLATE = """
|
||||
State changed to **{state}**:
|
||||
|
|
|
@ -2,6 +2,7 @@ from mock import MagicMock, patch
|
|||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class IntercomWebHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'test'
|
||||
URL_TEMPLATE = "/api/v1/external/intercom?&api_key={api_key}&stream={stream}"
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
from functools import partial
|
||||
from html.parser import HTMLParser
|
||||
from typing import Any, Dict, Tuple, Callable, List
|
||||
from typing import Any, Callable, Dict, List, Tuple
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message, \
|
||||
UnexpectedWebhookEventType
|
||||
from zerver.lib.webhooks.common import UnexpectedWebhookEventType, \
|
||||
check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
|
||||
COMPANY_CREATED = """
|
||||
New company **{name}** created:
|
||||
* **User count**: {user_count}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from urllib.parse import quote, unquote
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
from zerver.lib.users import get_api_key
|
||||
|
||||
|
||||
class JiraHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'jira'
|
||||
URL_TEMPLATE = u"/api/v1/external/jira?api_key={api_key}&stream={stream}"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Webhooks for external integrations.
|
||||
import re
|
||||
import string
|
||||
from typing import Any, Dict, List, Optional, Callable
|
||||
from typing import Any, Callable, Dict, List, Optional
|
||||
|
||||
from django.db.models import Q
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
@ -9,8 +9,8 @@ from django.http import HttpRequest, HttpResponse
|
|||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message, \
|
||||
UnexpectedWebhookEventType
|
||||
from zerver.lib.webhooks.common import UnexpectedWebhookEventType, \
|
||||
check_send_webhook_message
|
||||
from zerver.models import Realm, UserProfile, get_user_by_delivery_email
|
||||
|
||||
IGNORED_EVENTS = [
|
||||
|
|
|
@ -3,6 +3,7 @@ import urllib
|
|||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class LibratoHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'librato'
|
||||
URL_TEMPLATE = u"/api/v1/external/librato?api_key={api_key}&stream={stream}"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class MentionHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'test'
|
||||
URL_TEMPLATE = "/api/v1/external/mention?api_key={api_key}&stream={stream}"
|
||||
|
|
|
@ -9,6 +9,7 @@ from zerver.lib.response import json_success
|
|||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
|
||||
@api_key_only_webhook_view('Mention')
|
||||
@has_request_variables
|
||||
def api_mention_webhook(
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class NetlifyHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'netlify'
|
||||
URL_TEMPLATE = u"/api/v1/external/netlify?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -3,11 +3,11 @@ from typing import Any, Dict, Iterable
|
|||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message, \
|
||||
validate_extract_webhook_http_header, UnexpectedWebhookEventType, \
|
||||
get_http_headers_from_filename
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import UnexpectedWebhookEventType, \
|
||||
check_send_webhook_message, get_http_headers_from_filename, \
|
||||
validate_extract_webhook_http_header
|
||||
from zerver.models import UserProfile
|
||||
|
||||
EVENTS = ['deploy_failed', 'deploy_locked', 'deploy_unlocked', 'deploy_building', 'deploy_created']
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class NewRelicHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'newrelic'
|
||||
URL_TEMPLATE = u"/api/v1/external/newrelic?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -6,9 +6,9 @@ from django.http import HttpRequest, HttpResponse
|
|||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message, \
|
||||
UnexpectedWebhookEventType
|
||||
from zerver.lib.validator import check_dict
|
||||
from zerver.lib.webhooks.common import UnexpectedWebhookEventType, \
|
||||
check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
ALERT_TEMPLATE = "{long_description} ([view alert]({alert_url}))."
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
from zerver.webhooks.opbeat.view import get_value
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Webhooks for external integrations.
|
||||
from typing import Dict, Any, List
|
||||
from typing import Any, Dict, List
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class OpsGenieHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'opsgenie'
|
||||
URL_TEMPLATE = "/api/v1/external/opsgenie?&api_key={api_key}&stream={stream}"
|
||||
|
|
|
@ -8,6 +8,7 @@ from zerver.lib.response import json_success
|
|||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
|
||||
@api_key_only_webhook_view('OpsGenie')
|
||||
@has_request_variables
|
||||
def api_opsgenie_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class PagerDutyHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'pagerduty'
|
||||
URL_TEMPLATE = u"/api/v1/external/pagerduty?api_key={api_key}&stream={stream}"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Webhooks for external integrations.
|
||||
|
||||
from typing import Any, Dict, Iterable
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
@ -7,8 +6,8 @@ from django.http import HttpRequest, HttpResponse
|
|||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message, \
|
||||
UnexpectedWebhookEventType
|
||||
from zerver.lib.webhooks.common import UnexpectedWebhookEventType, \
|
||||
check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
PAGER_DUTY_EVENT_NAMES = {
|
||||
|
|
|
@ -2,6 +2,7 @@ from urllib.parse import urlencode
|
|||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class PapertrailHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'papertrail'
|
||||
URL_TEMPLATE = "/api/v1/external/papertrail?&api_key={api_key}&stream={stream}"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class PingdomHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'pingdom'
|
||||
URL_TEMPLATE = u"/api/v1/external/pingdom?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -6,8 +6,8 @@ from django.http import HttpRequest, HttpResponse
|
|||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message, \
|
||||
UnexpectedWebhookEventType
|
||||
from zerver.lib.webhooks.common import UnexpectedWebhookEventType, \
|
||||
check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
PINGDOM_TOPIC_TEMPLATE = '{name} status.'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class PivotalV3HookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'pivotal'
|
||||
URL_TEMPLATE = u"/api/v1/external/pivotal?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
"""Webhooks for external integrations."""
|
||||
|
||||
import re
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
|
||||
|
@ -11,10 +10,11 @@ from django.utils.translation import ugettext as _
|
|||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.request import has_request_variables
|
||||
from zerver.lib.response import json_error, json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message, \
|
||||
UnexpectedWebhookEventType
|
||||
from zerver.lib.webhooks.common import UnexpectedWebhookEventType, \
|
||||
check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
|
||||
def api_pivotal_webhook_v3(request: HttpRequest, user_profile: UserProfile) -> Tuple[str, str]:
|
||||
payload = xml_fromstring(request.body)
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import time
|
||||
from typing import Any, Dict
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
@ -5,12 +6,10 @@ from django.http import HttpRequest, HttpResponse
|
|||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message, \
|
||||
UnexpectedWebhookEventType
|
||||
from zerver.lib.webhooks.common import UnexpectedWebhookEventType, \
|
||||
check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
import time
|
||||
|
||||
|
||||
@api_key_only_webhook_view('Raygun')
|
||||
@has_request_variables
|
||||
|
|
|
@ -3,11 +3,11 @@ from typing import Any, Dict, Iterable
|
|||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import api_key_only_webhook_view
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message, \
|
||||
validate_extract_webhook_http_header, UnexpectedWebhookEventType, \
|
||||
get_http_headers_from_filename
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.webhooks.common import UnexpectedWebhookEventType, \
|
||||
check_send_webhook_message, get_http_headers_from_filename, \
|
||||
validate_extract_webhook_http_header
|
||||
from zerver.models import UserProfile
|
||||
|
||||
REVIEW_REQUEST_PUBLISHED = """
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class SemaphoreHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'semaphore'
|
||||
URL_TEMPLATE = "/api/v1/external/semaphore?stream={stream}&api_key={api_key}"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Webhooks for external integrations.
|
||||
|
||||
from typing import Any, Dict
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class SentryHookTests(WebhookTestCase):
|
||||
STREAM_NAME = 'sentry'
|
||||
URL_TEMPLATE = "/api/v1/external/sentry?&api_key={api_key}&stream={stream}"
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue