本文整理汇总了Python中mock.Mock.version方法的典型用法代码示例。如果您正苦于以下问题:Python Mock.version方法的具体用法?Python Mock.version怎么用?Python Mock.version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mock.Mock
的用法示例。
在下文中一共展示了Mock.version方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_test_reviews_window
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import version [as 别名]
def get_test_reviews_window():
from mock import Mock
appdetails_mock = Mock()
appdetails_mock.version = "2.0"
parent = Mock()
parent.app_details = appdetails_mock
review_data = Mock()
review_data.app_name = "app"
review_data.usefulness_favorable = 10
review_data.usefulness_total = 12
review_data.usefulness_submit_error = False
review_data.reviewer_username = "name"
review_data.reviewer_displayname = "displayname"
review_data.date_created = "2011-01-01 18:00:00"
review_data.summary = "summary"
review_data.review_text = 10 * "loonng text"
review_data.rating = "3.0"
review_data.version = "1.0"
# create reviewslist
vb = UIReviewsList(parent)
vb.add_review(review_data)
vb.configure_reviews_ui()
win = Gtk.Window()
win.set_size_request(200, 200)
win.add(vb)
win.connect('destroy', Gtk.main_quit)
win.show_all()
return win
示例2: get_test_reviews_window
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import version [as 别名]
def get_test_reviews_window():
appdetails_mock = Mock()
appdetails_mock.version = "2.0"
parent = Mock()
parent.app_details = appdetails_mock
review_data = Mock()
review_data.app_name = "app"
review_data.usefulness_favorable = 10
review_data.usefulness_total = 12
review_data.usefulness_submit_error = False
review_data.reviewer_username = "name"
review_data.reviewer_displayname = "displayname"
review_data.date_created = "2011-01-01 18:00:00"
review_data.summary = "summary"
review_data.review_text = 10 * "loonng text"
review_data.rating = "3.0"
review_data.version = "1.0"
# create reviewslist
vb = reviews.UIReviewsList(parent)
vb.add_review(review_data)
vb.configure_reviews_ui()
win = get_test_window(child=vb)
return win
示例3: test_get_current_version
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import version [as 别名]
def test_get_current_version(self):
mock_client = Mock(spec=["version"])
mock_client.version = '2.0-beta4-trusty-amd64'
ver = get_current_version(mock_client)
self.assertEqual(ver, '2.0-beta4')
mock_client.version = '1.25.4-trusty-amd64'
ver = get_current_version(mock_client)
self.assertEqual(ver, '1.25.4')
示例4: check_get_version
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import version [as 别名]
def check_get_version(self):
"""Check default and override behavior of get_version"""
node = None
assert get_version(node) == DEV_BRANCH
node = Mock()
node.version = None
assert get_version(node) == DEV_BRANCH
node = Mock()
node.version = V_0_8_2_2
assert get_version(node) == V_0_8_2_2
示例5: build_mac_mocks
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import version [as 别名]
def build_mac_mocks(self):
mac1 = Mock()
mac1.vendor = "Wirecloud"
mac1.short_name = "mac1"
mac1.version = "1.0"
mac1.template_uri = "Wirecloud_mac1_1.0.wgt"
mac2 = Mock()
mac2.vendor = "Wirecloud"
mac2.short_name = "mac2"
mac2.version = "1.0"
mac2.template_uri = "Wirecloud_mac2_1.0.wgt"
return mac1, mac2
示例6: test_storage_2x_with_aws
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import version [as 别名]
def test_storage_2x_with_aws(self):
mock_client = Mock(spec=["juju", "wait_for_started",
"create_storage_pool", "remove_service",
"list_storage_pool", "deploy",
"get_juju_output", "add_storage",
"list_storage", "is_juju1x"])
mock_client.series = 'trusty'
mock_client.version = '2.0'
mock_client.is_juju1x.return_value = False
mock_client.env = JujuData('foo', {'type': 'ec2'}, 'data')
expected_pool = dict(AWS_DEFAULT_STORAGE_POOL_DETAILS)
expected_pool.update(storage_pool_details)
mock_client.list_storage_pool.side_effect = [
json.dumps(expected_pool)
]
mock_client.list_storage.side_effect = self.make_expected_list_storage(
mock_client)
assess_storage(mock_client, mock_client.series)
self.assertEqual(
[
call('ebsy', 'ebs', '1G'),
call('loopy', 'loop', '1G'),
call('rooty', 'rootfs', '1G'),
call('tempy', 'tmpfs', '1G')
],
mock_client.create_storage_pool.mock_calls)
self.assertEqual(
[
call('dummy-storage-lp/0', 'disks', '1')
],
mock_client.add_storage.mock_calls
)
示例7: test_Adds_niprov_version
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import version [as 别名]
def test_Adds_niprov_version(self):
with patch('niprov.adding.pkg_resources') as pkgres:
dist = Mock()
dist.version = '5.4.1'
pkgres.get_distribution.return_value = dist
image = self.add('p/afile.f')
self.assertEqual(self.lastProvenance['version-added'], 5.41)
示例8: test_get_output
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import version [as 别名]
def test_get_output(self):
pack = Mock()
pack.package_format = 2
pack.name = 'foopack'
pack.version = '0.1.2'
pack.maintainers = ['m1', 'm2']
pack.build_depends = ['bd1', 'bd2']
pack.buildtool_depends = ['catkin']
pack.build_export_depends = ['bed1', 'bed2']
pack.buildtool_export_depends = ['bted1', 'bted2']
pack.exec_depends = ['ed1', 'ed2']
pack.run_depends = ['rd1', 'rd2']
pack.test_depends = ['td1', 'td2']
pack.doc_depends = ['dd1', 'dd2']
pack.exports = []
result = _get_output(pack)
self.assertEqual(
set([
'set(_CATKIN_CURRENT_PACKAGE "foopack")',
'set(foopack_MAINTAINER "m1, m2")',
'set(foopack_PACKAGE_FORMAT "2")',
'set(foopack_DEPRECATED "")',
'set(foopack_VERSION "0.1.2")',
'set(foopack_BUILD_DEPENDS "bd1" "bd2")',
'set(foopack_BUILDTOOL_DEPENDS "catkin")',
'set(foopack_BUILD_EXPORT_DEPENDS "bed1" "bed2")',
'set(foopack_BUILDTOOL_EXPORT_DEPENDS "bted1" "bted2")',
'set(foopack_EXEC_DEPENDS "ed1" "ed2")',
'set(foopack_RUN_DEPENDS "rd1" "rd2")',
'set(foopack_TEST_DEPENDS "td1" "td2")',
'set(foopack_DOC_DEPENDS "dd1" "dd2")',
]),
set(result))
示例9: test_pinned_requirement
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import version [as 别名]
def test_pinned_requirement(self):
req = Mock()
req.key = "django"
req.is_pinned = True
req.latest_version_within_specs = "1.10"
req.version = "1.0"
self.assertEqual(Update.get_commit_message(req), "Update django from 1.0 to 1.10")
示例10: test_requirement_pinned
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import version [as 别名]
def test_requirement_pinned(self):
req = Mock()
req.key = "django"
req.is_pinned = True
req.latest_version_within_specs = "1.10"
req.version = "1.0"
self.assertEqual(SequentialUpdate.get_branch(req), "pyup-update-django-1.0-to-1.10")
示例11: test_all_duplicate_reviews_keeps_going
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import version [as 别名]
def test_all_duplicate_reviews_keeps_going(self, mock_get_reviews):
"""AppDetailsView._reviews_ready_callback will fetch another page if
all data returned was already displayed in the reviews list.
"""
# Fixme: Do we have a test factory?
review = Mock()
review.rating = 3
review.date_created = "2011-01-01 18:00:00"
review.version = "1.0"
review.summary = 'some summary'
review.review_text = 'Some text'
review.reviewer_username = "name"
review.reviewer_displayname = "displayname"
reviews = [review]
self.view.reviews.reviews = reviews
self.view._do_load_reviews()
self.assertEqual(1, mock_get_reviews.call_count)
kwargs = mock_get_reviews.call_args[1]
self.assertEqual(False, kwargs['relaxed'])
self.assertEqual(1, kwargs['page'])
# Now we come back with no NEW data
application, callback = mock_get_reviews.call_args[0]
callback(application, reviews)
self.assertEqual(2, mock_get_reviews.call_count)
kwargs = mock_get_reviews.call_args[1]
self.assertEqual(False, kwargs['relaxed'])
self.assertEqual(2, kwargs['page'])
示例12: default_args
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import version [as 别名]
def default_args():
args = Mock()
args.conf_file = '.lamvery.yml'
args.alias = 'foo'
args.version = '1'
args.json = '{"foo": "bar"}'
return args
示例13: test_storage_2x
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import version [as 别名]
def test_storage_2x(self):
mock_client = Mock(spec=["juju", "wait_for_started",
"create_storage_pool", "remove_service",
"list_storage_pool", "deploy",
"get_juju_output", "add_storage",
"list_storage", "is_juju1x"])
mock_client.series = 'trusty'
mock_client.version = '2.0'
mock_client.is_juju1x.return_value = False
mock_client.env = Mock(config={'type': 'local'})
mock_client.list_storage_pool.side_effect = [
json.dumps(storage_pool_details)
]
mock_client.list_storage.side_effect = self.make_expected_list_storage(
mock_client)
assess_storage(mock_client, mock_client.series)
self.assertEqual(
[
call('ebsy', 'ebs', '1G'),
call('loopy', 'loop', '1G'),
call('rooty', 'rootfs', '1G'),
call('tempy', 'tmpfs', '1G')
],
mock_client.create_storage_pool.mock_calls)
self.assertEqual(
[
call('dummy-storage-lp/0', 'disks', '1')
],
mock_client.add_storage.mock_calls
)
示例14: test_verify_ceph_version_success
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import version [as 别名]
def test_verify_ceph_version_success(self, m_get_package_version,
m_gitbuilder_project):
gb = Mock()
gb.version = "0.89.0"
gb.project = "ceph"
m_gitbuilder_project.return_value = gb
m_get_package_version.return_value = "0.89.0"
install.verify_package_version(Mock(), Mock(), Mock())
示例15: default_args
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import version [as 别名]
def default_args():
args = Mock()
args.conf_file = '.lamvery.yml'
args.dry_run = True
args.publish = True
args.alias = None
args.version = None
return args