File: _messages_test_case_async.py

package info (click to toggle)
python-azure 20250603%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 851,724 kB
  • sloc: python: 7,362,925; ansic: 804; javascript: 287; makefile: 195; sh: 145; xml: 109
file content (37 lines) | stat: -rw-r--r-- 1,448 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------

import asyncio
from abc import abstractmethod
from retry import retry
import warnings
from _shared.utils import get_http_logging_policy
from azure.communication.messages.aio import (
    NotificationMessagesClient,
    MessageTemplateClient,
)
from devtools_testutils import AzureRecordedTestCase


class AsyncMessagesRecordedTestCase(AzureRecordedTestCase):

    def create_notification_message_client(self) -> NotificationMessagesClient:
        return NotificationMessagesClient.from_connection_string(
            conn_str=self.connection_string, http_logging_policy=get_http_logging_policy()
        )

    def create_notification_message_client_from_token(self) -> NotificationMessagesClient:
        return NotificationMessagesClient.from_token_credentials(
            endpoint=self.endpoint_str, http_logging_policy=get_http_logging_policy()
        )

    def create_message_template_client(self) -> MessageTemplateClient:
        return MessageTemplateClient.from_connection_string(
            conn_str=self.connection_string, http_logging_policy=get_http_logging_policy()
        )

    def create_message_template_client_from_token(self) -> MessageTemplateClient:
        return MessageTemplateClient.from_token_credentials(
            endpoint=self.endpoint_str, http_logging_policy=get_http_logging_policy()
        )