tests: Add coverage to get_service_interface_class().

This commit is contained in:
Steve Howell 2018-10-11 17:07:09 +00:00 committed by Tim Abbott
parent 8379aeee15
commit 51bd36e448
1 changed files with 13 additions and 9 deletions

View File

@ -5,10 +5,12 @@ import mock
import json
import requests
from zerver.lib.outgoing_webhook import GenericOutgoingWebhookService, \
SlackOutgoingWebhookService, process_success_response
from zerver.lib.outgoing_webhook import (
get_service_interface_class,
process_success_response,
)
from zerver.lib.test_classes import ZulipTestCase
from zerver.models import Service, get_realm, get_user
from zerver.models import Service, get_realm, get_user, SLACK_INTERFACE
class TestGenericOutgoingWebhookService(ZulipTestCase):
@ -21,7 +23,8 @@ class TestGenericOutgoingWebhookService(ZulipTestCase):
u'trigger': 'mention',
}
self.bot_user = get_user("outgoing-webhook@zulip.com", get_realm("zulip"))
self.handler = GenericOutgoingWebhookService(service_name='test-service',
service_class = get_service_interface_class('whatever') # GenericOutgoingWebhookService
self.handler = service_class(service_name='test-service',
token='abcdef',
user_profile=self.bot_user)
@ -120,7 +123,8 @@ class TestSlackOutgoingWebhookService(ZulipTestCase):
}
}
self.handler = SlackOutgoingWebhookService(token="abcdef",
service_class = get_service_interface_class(SLACK_INTERFACE)
self.handler = service_class(token="abcdef",
user_profile=None,
service_name='test-service')