Ejemplo n.º 1
0
    def test_list(self, request):
        resp = create_mock_json('tests/resources/monitor/alerts_list.json')
        resp.status_code = 200
        request.return_value = resp

        uri = "{0}/Alerts".format(BASE_URI)
        list_resource = Alerts(BASE_URI, AUTH)
        list_resource.list()
        request.assert_called_with("GET", uri, params={}, auth=AUTH, use_json_extension=False)
Ejemplo n.º 2
0
    def test_get(self, request):
        resp = create_mock_json('tests/resources/monitor/alerts_instance.json')
        resp.status_code = 200
        request.return_value = resp

        uri = "{0}/Alerts/{1}".format(BASE_URI, EVENT_SID)
        list_resource = Alerts(BASE_URI, AUTH)
        list_resource.get(EVENT_SID)
        request.assert_called_with("GET", uri, auth=AUTH, use_json_extension=False)
Ejemplo n.º 3
0
    def test_get(self, request):
        resp = create_mock_json('tests/resources/monitor/alerts_instance.json')
        resp.status_code = 200
        request.return_value = resp

        uri = "{0}/Alerts/{1}".format(BASE_URI, EVENT_SID)
        list_resource = Alerts(BASE_URI, AUTH)
        list_resource.get(EVENT_SID)
        request.assert_called_with("GET",
                                   uri,
                                   auth=AUTH,
                                   use_json_extension=False)
Ejemplo n.º 4
0
    def test_list(self, request):
        resp = create_mock_json('tests/resources/monitor/alerts_list.json')
        resp.status_code = 200
        request.return_value = resp

        uri = "{0}/Alerts".format(BASE_URI)
        list_resource = Alerts(BASE_URI, AUTH)
        list_resource.list()
        request.assert_called_with("GET",
                                   uri,
                                   params={},
                                   auth=AUTH,
                                   use_json_extension=False)
Ejemplo n.º 5
0
    def __init__(self, account=None, token=None,
                 base="https://monitor.twilio.com", version="v1",
                 timeout=UNSET_TIMEOUT, request_account=None):

        super(TwilioMonitorClient, self).__init__(account, token, base,
                                                  version, timeout,
                                                  request_account)

        self.version_uri = "%s/%s" % (base, version)
        self.events = Events(self.version_uri, self.auth, timeout)
        self.alerts = Alerts(self.version_uri, self.auth, timeout)