本文整理汇总了Python中zato.common.test.rand_bool函数的典型用法代码示例。如果您正苦于以下问题:Python rand_bool函数的具体用法?Python rand_bool怎么用?Python rand_bool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rand_bool函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_response
def test_response(self):
request = {'cluster_id':rand_int(), 'name':rand_string()}
expected_id = rand_int()
expected_name = rand_string()
expected_is_active = rand_bool()
expected_impl_name = rand_string()
expected_is_internal = rand_bool()
service = Service()
service.id = expected_id
service.name = expected_name
service.is_active = expected_is_active
service.impl_name = expected_impl_name
service.is_internal = expected_is_internal
expected = Expected()
expected.add(service)
instance = self.invoke(GetByName, request, expected)
response = Bunch(loads(instance.response.payload.getvalue())['response'])
eq_(response.id, expected_id)
eq_(response.name, expected_name)
eq_(response.is_active, expected_is_active)
eq_(response.impl_name, expected_impl_name)
eq_(response.is_internal, expected_is_internal)
eq_(response.usage, 0)
示例2: get_response_data
def get_response_data(self):
return Bunch({'id':rand_int(), 'name':self.name, 'host':rand_string(), 'port':rand_int(),
'queue_manager':rand_int(), 'channel':rand_string(),
'cache_open_send_queues':rand_bool(), 'cache_open_receive_queues':rand_bool(),
'use_shared_connections':rand_bool(), 'ssl':rand_bool(),
'needs_mcd':rand_bool(), 'max_chars_printed':rand_int(),
'ssl_cipher_spec':rand_string(), 'ssl_key_repository':rand_string()})
示例3: test_topic_custom_attrs
def test_topic_custom_attrs(self):
name = rand_string()
is_active = rand_bool()
is_fifo = rand_bool()
max_depth = rand_int()
topic = self._get_object(Topic, {
'name':name, 'is_active':is_active, 'is_fifo':is_fifo, 'max_depth':max_depth
})
self.assertEquals(topic.name, name)
self.assertEquals(topic.is_active, is_active)
self.assertEquals(topic.is_fifo, is_fifo)
self.assertEquals(topic.max_depth, max_depth)
示例4: get_response_data
def get_response_data(self):
return Bunch({'id':rand_int(), 'name':self.name, 'is_active':rand_bool(), 'is_internal':rand_bool(),
'url_path':rand_string(), 'service_id':rand_int(), 'service_name':rand_string(), 'security_id':rand_int(),
'security_name':rand_int(), 'sec_type':rand_string(), 'method':rand_string(), 'soap_action':rand_string(),
'soap_version':rand_string(), 'data_format':rand_string(), 'host':rand_string(), 'ping_method':rand_string(),
'pool_size':rand_int()}
)
示例5: test_nested_from_json
def test_nested_from_json(self):
n = Nested('elem', 'sub1', Bool('my_bool1'), 'sub2', 'sub3', Dict('my_dict1', 'key1', 'key2'))
expected_sub1_1 = rand_string()
expected_sub2_1 = rand_string()
expected_sub3_1 = rand_string()
expected_my_bool1_1 = rand_bool()
expected_key1_1 = rand_string()
expected_key2_1 = rand_string()
value1 = {'elem': {
'sub1': expected_sub1_1,
'sub2': expected_sub2_1,
'my_bool1': expected_my_bool1_1,
'sub3': expected_sub3_1,
'my_dict1' : {
'key1': expected_key1_1,
'key2': expected_key2_1,
}
}}
ret_value = n.from_json(value1)
eq_(ret_value,
{'elem':
{'my_bool1': expected_my_bool1_1, 'sub2': expected_sub2_1, 'sub3': expected_sub3_1,
'my_dict1': {'key2': expected_key2_1, 'key1': expected_key1_1},
'sub1': expected_sub1_1}}
)
示例6: test_nested_to_json
def test_nested_to_json(self):
n = Nested('elem', 'sub1', Bool('my_bool1'), 'sub2', 'sub3', Dict('my_dict1', 'key1', 'key2'))
expected_sub1_2 = rand_string()
expected_sub2_2 = rand_string()
expected_sub3_2 = rand_string()
expected_my_bool1_2 = rand_bool()
expected_key1_2 = rand_string()
expected_key2_2 = rand_string()
value2 = {'elem': {
'sub1': expected_sub1_2,
'sub2': expected_sub2_2,
'my_bool1': expected_my_bool1_2,
'sub3': expected_sub3_2,
'my_dict1' : {
'key1': expected_key1_2,
'key2': expected_key2_2,
}
}}
ret_value = n.to_json(value2)
eq_(ret_value,
{'elem':
{'my_bool1': expected_my_bool1_2, 'sub2': expected_sub2_2, 'sub3': expected_sub3_2,
'my_dict1': {'key2': expected_key2_2, 'key1': expected_key1_2},
'sub1': expected_sub1_2}}
)
示例7: test_client_custom_attrs
def test_client_custom_attrs(self):
id, name, is_active = rand_int(), rand_string(), rand_bool()
client = Client(id, name, is_active)
self.assertEquals(client.id, id)
self.assertEquals(client.name, name)
self.assertEquals(client.is_active, is_active)
示例8: get_response_data
def get_response_data(self):
return Bunch(
{
"id": rand_int(),
"name": rand_string,
"is_active": rand_bool(),
"sec_type": rand_string(),
"username": rand_string(),
"realm": rand_string(),
"password_type": rand_string(),
"reject_empty_nonce_creat": rand_bool(),
"reject_stale_tokens": rand_bool(),
"reject_expiry_limit": rand_int(),
"nonce_freshness_time": rand_int(),
}
)
示例9: test_not_implemented_error
def test_not_implemented_error(self):
inner = FakeInnerResponse({}, rand_int(), rand_string(), rand_int())
response_data = (inner, rand_bool(), rand_int(), rand_int(), None)
self.assertRaises(NotImplementedError, _Response, *response_data)
self.assertRaises(NotImplementedError, _StructuredResponse(*response_data).load_func)
self.assertRaises(NotImplementedError, _StructuredResponse(*response_data).set_has_data)
示例10: get_response_data
def get_response_data(self):
return Bunch(
{'id':rand_int(), 'name':rand_string(), 'is_active':rand_bool(), 'def_id':rand_int(),
'delivery_mode':rand_int(), 'priority':rand_int(), 'def_name':rand_string(),
'content_type':rand_string(), 'content_encoding':rand_string(),
'cexpiration':rand_int(), 'user_id':rand_string(),
'app_id':rand_string()}
)
示例11: setUp
def setUp(self):
self.url = rand_string()
self.auth = None
self.path = rand_string()
self.session = FakeSession()
self.to_bunch = rand_bool()
self.max_response_repr = 10000
self.max_cid_repr = rand_int()
self.logger = rand_object()
示例12: get_request_data
def get_request_data(self):
return {
"cluster_id": rand_int(),
"name": self.name,
"is_active": rand_bool(),
"address": rand_string(),
"socket_type": rand_string(),
"service": rand_string(),
"sub_key": rand_string(),
"data_format": rand_string(),
}
示例13: test_get_ctx_custom_attrs
def test_get_ctx_custom_attrs(self):
sub_key = rand_string()
max_batch_size = rand_int()
is_fifo = rand_bool()
get_format = rand_string()
ctx = GetCtx(sub_key, max_batch_size, is_fifo, get_format)
self.assertEquals(ctx.sub_key, sub_key)
self.assertEquals(ctx.max_batch_size, max_batch_size)
self.assertEquals(ctx.is_fifo, is_fifo)
self.assertEquals(ctx.get_format, get_format)
示例14: get_response_data
def get_response_data(self):
return Bunch(
{
"id": rand_int(),
"name": rand_string(),
"is_active": rand_bool(),
"address": rand_string(),
"socket_type": rand_string(),
"sub_key": rand_string(),
"service_name": rand_string(),
"data_format": rand_string(),
}
)
示例15: test_topic_add
def test_topic_add(self):
name = rand_string()
is_active = rand_bool()
is_fifo = rand_bool()
max_depth = rand_int()
topic = Topic(name, is_active, is_fifo, max_depth)
self.api.add_topic(topic)
self.assertIn(name, self.api.impl.topics)
self.assertEquals(len(self.api.impl.topics), 1)
given = self.api.impl.topics[name]
self.assertEquals(given.name, name)
self.assertEquals(given.is_active, is_active)
self.assertEquals(given.is_fifo, is_fifo)
self.assertEquals(given.max_depth, max_depth)
# Adding topic of the same name should not create a new topic because impl.topics is a dictionary
self.api.add_topic(topic)
self.assertEquals(len(self.api.impl.topics), 1)