本文整理汇总了Python中zato.common.test.rand_bool函数的典型用法代码示例。如果您正苦于以下问题:Python rand_bool函数的具体用法?Python rand_bool怎么用?Python rand_bool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rand_bool函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
开发者ID:dsuch,项目名称:zato,代码行数:28,代码来源:test_service.py
示例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()})
开发者ID:barowski,项目名称:zato,代码行数:7,代码来源:test_jms_wmq.py
示例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)
开发者ID:azazel75,项目名称:zato,代码行数:14,代码来源:test_api_impl.py
示例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()}
)
开发者ID:Aayush-Kasurde,项目名称:zato,代码行数:7,代码来源:test_http_soap.py
示例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}}
)
开发者ID:Aayush-Kasurde,项目名称:zato,代码行数:30,代码来源:test_sio.py
示例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}}
)
开发者ID:Aayush-Kasurde,项目名称:zato,代码行数:30,代码来源:test_sio.py
示例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)
开发者ID:azazel75,项目名称:zato,代码行数:7,代码来源:test_api_impl.py
示例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(),
}
)
开发者ID:lucval,项目名称:zato,代码行数:16,代码来源:test__init__.py
示例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)
开发者ID:Aayush-Kasurde,项目名称:zato,代码行数:7,代码来源:test_client.py
示例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()}
)
开发者ID:grenzi,项目名称:ctakes_exploration,代码行数:8,代码来源:test_amqp.py
示例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()
开发者ID:Aayush-Kasurde,项目名称:zato,代码行数:9,代码来源:test_client.py
示例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(),
}
开发者ID:pombredanne,项目名称:zato,代码行数:11,代码来源:test_zmq.py
示例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)
开发者ID:azazel75,项目名称:zato,代码行数:12,代码来源:test_api_impl.py
示例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(),
}
)
开发者ID:pombredanne,项目名称:zato,代码行数:13,代码来源:test_zmq.py
示例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)
开发者ID:azazel75,项目名称:zato,代码行数:22,代码来源:test_api_impl.py
示例16: test_default_clients
def test_default_clients(self):
# Initially, default clients are dummy ones.
default_consumer = self.api.get_default_consumer()
default_producer = self.api.get_default_producer()
self.assertEquals(default_consumer.id, None)
self.assertEquals(default_consumer.name, None)
self.assertEquals(default_consumer.is_active, True)
self.assertEquals(default_producer.id, None)
self.assertEquals(default_producer.name, None)
self.assertEquals(default_producer.is_active, True)
cons_id = rand_int()
cons_name = rand_string()
cons_is_active = rand_bool()
prod_name = rand_string()
prod_id = rand_int()
prod_is_active = rand_bool()
cons = Client(cons_id, cons_name, cons_is_active)
prod = Client(prod_id, prod_name, prod_is_active)
self.api.set_default_consumer(cons)
self.api.set_default_producer(prod)
default_consumer = self.api.get_default_consumer()
default_producer = self.api.get_default_producer()
self.assertEquals(default_consumer.id, cons_id)
self.assertEquals(default_consumer.name, cons_name)
self.assertEquals(default_consumer.is_active, cons_is_active)
self.assertEquals(default_producer.id, prod_id)
self.assertEquals(default_producer.name, prod_name)
self.assertEquals(default_producer.is_active, prod_is_active)
开发者ID:azazel75,项目名称:zato,代码行数:37,代码来源:test_api_impl.py
示例17: test_consumer_custom_attrs
def test_consumer_custom_attrs(self):
id = rand_int()
name = rand_string()
is_active = rand_bool()
sub_key = rand_string()
max_backlog = rand_int()
delivery_mode = rand_string()
callback_id = rand_int()
consumer = Consumer(id, name, is_active, sub_key, max_backlog, delivery_mode, callback_id)
self.assertEquals(consumer.id, id)
self.assertEquals(consumer.name, name)
self.assertEquals(consumer.is_active, is_active)
self.assertEquals(consumer.sub_key, sub_key)
self.assertEquals(consumer.max_backlog, max_backlog)
self.assertEquals(consumer.delivery_mode, delivery_mode)
self.assertEquals(consumer.callback_id, callback_id)
开发者ID:azazel75,项目名称:zato,代码行数:17,代码来源:test_api_impl.py
示例18: test_get_context
def test_get_context(self):
id = rand_int()
name = rand_string()
start_time = rand_date_utc()
interval_in_seconds = rand_int()
max_repeats_reached = rand_bool()
current_run, max_repeats = rand_int(count=2)
cb_kwargs = {rand_string():rand_string()}
for job_type in SCHEDULER.JOB_TYPE.INTERVAL_BASED, SCHEDULER.JOB_TYPE.CRON_STYLE:
interval=Interval(in_seconds=interval_in_seconds) if \
job_type == SCHEDULER.JOB_TYPE.INTERVAL_BASED else CronTab(DEFAULT_CRON_DEFINITION)
job = Job(id, name, job_type, cb_kwargs=cb_kwargs, interval=interval)
job.start_time = start_time
job.current_run = current_run
job.max_repeats = max_repeats
job.max_repeats_reached = max_repeats_reached
if job_type == SCHEDULER.JOB_TYPE.CRON_STYLE:
job.cron_definition = DEFAULT_CRON_DEFINITION
ctx = job.get_context()
cid = ctx.pop('cid')
self.assertTrue(is_like_cid(cid))
expected = {
'current_run': current_run,
'id': id,
'name': name,
'start_time': start_time.isoformat(),
'max_repeats': max_repeats,
'max_repeats_reached': max_repeats_reached,
'cb_kwargs': cb_kwargs,
'type': job_type,
}
if job_type == SCHEDULER.JOB_TYPE.CRON_STYLE:
expected['cron_definition'] = job.cron_definition
else:
expected['interval_in_seconds'] = job.interval.in_seconds
self.assertDictEqual(ctx, expected)
开发者ID:Aayush-Kasurde,项目名称:zato,代码行数:46,代码来源:test_scheduler.py
示例19: get_request_data
def get_request_data(self):
return {'id':rand_int(), 'cluster_id':rand_int(), 'name':rand_string(), 'is_active':rand_bool(), 'def_id':rand_int(),
'delivery_mode':rand_string(),'priority':rand_int(), 'content_type':rand_string(), 'content_encoding':rand_string(),
'expiration':rand_int(), 'user_id':rand_string(), 'app_id':rand_string()}
开发者ID:grenzi,项目名称:ctakes_exploration,代码行数:4,代码来源:test_amqp.py
示例20: get_response_data
def get_response_data(self):
return Bunch({'id':rand_int(), 'name':self.name, 'is_active':rand_bool(), 'password_type':rand_string(), 'username':rand_string(),
'reject_empty_nonce_creat':rand_bool(), 'reject_stale_tokens':rand_bool(), 'reject_expiry_limit':rand_int(),
'nonce_freshness_time':rand_int()}
)
开发者ID:Aayush-Kasurde,项目名称:zato,代码行数:5,代码来源:test_wss.py
注:本文中的zato.common.test.rand_bool函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论