本文整理匯總了Python中mock.NonCallableMock.get_dbs方法的典型用法代碼示例。如果您正苦於以下問題:Python NonCallableMock.get_dbs方法的具體用法?Python NonCallableMock.get_dbs怎麽用?Python NonCallableMock.get_dbs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mock.NonCallableMock
的用法示例。
在下文中一共展示了NonCallableMock.get_dbs方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_pushapps_export
# 需要導入模塊: from mock import NonCallableMock [as 別名]
# 或者: from mock.NonCallableMock import get_dbs [as 別名]
def test_pushapps_export(discover_apps_, hook, document_, dumps):
'''
Test case for pushapps with ``--export``,
Algo:
1. discover apps
#. pre-push
#. add app to a list ``apps``
#. post-push
#. json.dumps from apps
'''
conf = NonCallableMock(name='conf')
dest = None
ret_code = commands.pushapps(conf, '/mock_dir', dest, export=True)
assert ret_code == 0
discover_apps_.assert_called_with('/mock_dir')
hook.assert_any_call(conf, 'foo', 'pre-push',
dbs=conf.get_dbs(), pushapps=True)
hook.assert_any_call(conf, 'foo', 'post-push',
dbs=conf.get_dbs(), pushapps=True)
assert dumps.called
示例2: test_pushapps_output
# 需要導入模塊: from mock import NonCallableMock [as 別名]
# 或者: from mock.NonCallableMock import get_dbs [as 別名]
def test_pushapps_output(discover_apps_, hook, document_, write_json):
'''
Test case for pushapps with ``--export --output file``
Algo:
1. discover apps
#. pre-push
#. add app to a list ``apps``
#. post-push
#. write_json(apps)
'''
conf = NonCallableMock(name='conf')
dest = None
ret_code = commands.pushapps(conf, '/mock_dir', dest, export=True, output='file')
assert ret_code == 0
discover_apps_.assert_called_with('/mock_dir')
hook.assert_any_call(conf, 'foo', 'pre-push',
dbs=conf.get_dbs(), pushapps=True)
hook.assert_any_call(conf, 'foo', 'post-push',
dbs=conf.get_dbs(), pushapps=True)
'file' in write_json.call_args[0]
示例3: test_pushapps_noatomic
# 需要導入模塊: from mock import NonCallableMock [as 別名]
# 或者: from mock.NonCallableMock import get_dbs [as 別名]
def test_pushapps_noatomic(discover_apps_, hook, document_):
'''
Test case for pushapps with ``--no-atomic``
Algo:
1. discover apps
#. for each app
1. pre-push
2. push
3. post-push
'''
conf = NonCallableMock(name='conf')
dest = 'http://localhost:5984'
doc = document_()
dbs = conf.get_dbs()
ret_code = commands.pushapps(conf, '/mock_dir', dest, no_atomic=True)
assert ret_code == 0
conf.get_dbs.assert_called_with(dest)
hook.assert_any_call(conf, 'foo', 'pre-push', dbs=dbs, pushapps=True)
hook.assert_any_call(conf, 'foo', 'post-push', dbs=dbs, pushapps=True)
doc.push.assert_called_with(dbs, True, False)