本文整理汇总了Python中test.ably.restsetup.RestSetup.get_test_vars方法的典型用法代码示例。如果您正苦于以下问题:Python RestSetup.get_test_vars方法的具体用法?Python RestSetup.get_test_vars怎么用?Python RestSetup.get_test_vars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test.ably.restsetup.RestSetup
的用法示例。
在下文中一共展示了RestSetup.get_test_vars方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_request_token_with_specified_key
# 需要导入模块: from test.ably.restsetup import RestSetup [as 别名]
# 或者: from test.ably.restsetup.RestSetup import get_test_vars [as 别名]
def test_request_token_with_specified_key(self):
key = RestSetup.get_test_vars()["keys"][1]
token_details = self.ably.auth.request_token(
key_name=key["key_name"], key_secret=key["key_secret"])
self.assertIsNotNone(token_details.token, msg="Expected token")
self.assertEqual(key.get("capability"),
token_details.capability,
msg="Unexpected capability")
示例2: setUpClass
# 需要导入模块: from test.ably.restsetup import RestSetup [as 别名]
# 或者: from test.ably.restsetup.RestSetup import get_test_vars [as 别名]
def setUpClass(cls):
RestSetup._RestSetup__test_vars = None
test_vars = RestSetup.get_test_vars()
cls.ably = AblyRest(key=test_vars["keys"][0]["key_str"],
rest_host=test_vars["host"],
port=test_vars["port"],
tls_port=test_vars["tls_port"],
tls=test_vars["tls"])
cls.ably_text = AblyRest(key=test_vars["keys"][0]["key_str"],
rest_host=test_vars["host"],
port=test_vars["port"],
tls_port=test_vars["tls_port"],
tls=test_vars["tls"],
use_binary_protocol=False)
cls.last_year = datetime.now().year - 1
cls.previous_year = datetime.now().year - 2
cls.last_interval = datetime(cls.last_year, 2, 3, 15, 5)
cls.previous_interval = datetime(cls.previous_year, 2, 3, 15, 5)
previous_year_stats = 120
stats = [
{
'intervalId': Stats.to_interval_id(cls.last_interval -
timedelta(minutes=2),
'minute'),
'inbound': {'realtime': {'messages': {'count': 50, 'data': 5000}}},
'outbound': {'realtime': {'messages': {'count': 20, 'data': 2000}}}
},
{
'intervalId': Stats.to_interval_id(cls.last_interval - timedelta(minutes=1),
'minute'),
'inbound': {'realtime': {'messages': {'count': 60, 'data': 6000}}},
'outbound': {'realtime': {'messages': {'count': 10, 'data': 1000}}}
},
{
'intervalId': Stats.to_interval_id(cls.last_interval, 'minute'),
'inbound': {'realtime': {'messages': {'count': 70, 'data': 7000}}},
'outbound': {'realtime': {'messages': {'count': 40, 'data': 4000}}},
'persisted': {'presence': {'count': 20, 'data': 2000}},
'connections': {'tls': {'peak': 20, 'opened': 10}},
'channels': {'peak': 50, 'opened': 30},
'apiRequests': {'succeeded': 50, 'failed': 10},
'tokenRequests': {'succeeded': 60, 'failed': 20},
}
]
previous_stats = []
for i in range(previous_year_stats):
previous_stats.append(
{
'intervalId': Stats.to_interval_id(cls.previous_interval -
timedelta(minutes=i),
'minute'),
'inbound': {'realtime': {'messages': {'count': i}}}
}
)
cls.ably.http.post('/stats', native_data=stats + previous_stats)
示例3: import
# 需要导入模块: from test.ably.restsetup import RestSetup [as 别名]
# 或者: from test.ably.restsetup.RestSetup import get_test_vars [as 别名]
import six
import msgpack
import responses
from ably import AblyRest
from ably.http.paginatedresult import PaginatedResult
from ably.types.presence import (PresenceMessage,
make_encrypted_presence_response_handler)
from ably import ChannelOptions
from ably.util.crypto import get_default_params
from test.ably.utils import dont_vary_protocol, VaryByProtocolTestsMetaclass, BaseTestCase
from test.ably.restsetup import RestSetup
test_vars = RestSetup.get_test_vars()
@six.add_metaclass(VaryByProtocolTestsMetaclass)
class TestPresence(BaseTestCase):
def setUp(self):
self.ably = AblyRest(test_vars["keys"][0]["key_str"],
rest_host=test_vars["host"],
port=test_vars["port"],
tls_port=test_vars["tls_port"],
tls=test_vars["tls"])
self.per_protocol_setup(True)
def per_protocol_setup(self, use_binary_protocol):
# This will be called every test that vary by protocol for each protocol
示例4: setup
# 需要导入模块: from test.ably.restsetup import RestSetup [as 别名]
# 或者: from test.ably.restsetup.RestSetup import get_test_vars [as 别名]
def setup():
RestSetup.get_test_vars()
yield
RestSetup.clear_test_vars()
示例5: setup_package
# 需要导入模块: from test.ably.restsetup import RestSetup [as 别名]
# 或者: from test.ably.restsetup.RestSetup import get_test_vars [as 别名]
def setup_package():
RestSetup.get_test_vars()
示例6: test_request_token_with_specified_key
# 需要导入模块: from test.ably.restsetup import RestSetup [as 别名]
# 或者: from test.ably.restsetup.RestSetup import get_test_vars [as 别名]
def test_request_token_with_specified_key(self):
key = RestSetup.get_test_vars()["keys"][1]
token_details = self.ably.auth.request_token(
key_name=key["key_name"], key_secret=key["key_secret"])
assert token_details.token is not None, "Expected token"
assert key.get("capability") == token_details.capability, "Unexpected capability"