本文整理汇总了Python中senlin.db.sqlalchemy.api.cluster_get_all函数的典型用法代码示例。如果您正苦于以下问题:Python cluster_get_all函数的具体用法?Python cluster_get_all怎么用?Python cluster_get_all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cluster_get_all函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_cluster_get_all_filters_sort_keys
def test_cluster_get_all_filters_sort_keys(self, mock_paginate):
sort = 'name,status,created_at,updated_at'
db_api.cluster_get_all(self.ctx, sort=sort)
args = mock_paginate.call_args[0]
used_sort_keys = set(args[3])
expected_keys = set(['name', 'status', 'created_at',
'updated_at', 'id'])
self.assertEqual(expected_keys, used_sort_keys)
开发者ID:onesafe,项目名称:senlin,代码行数:9,代码来源:test_cluster_api.py
示例2: test_cluster_get_all_with_filters
def test_cluster_get_all_with_filters(self):
shared.create_cluster(self.ctx, self.profile, name='foo')
shared.create_cluster(self.ctx, self.profile, name='bar')
filters = {'name': ['bar', 'quux']}
results = db_api.cluster_get_all(self.ctx, filters=filters)
self.assertEqual(1, len(results))
self.assertEqual('bar', results[0]['name'])
filters = {'name': 'foo'}
results = db_api.cluster_get_all(self.ctx, filters=filters)
self.assertEqual(1, len(results))
self.assertEqual('foo', results[0]['name'])
开发者ID:Alzon,项目名称:senlin,代码行数:13,代码来源:test_cluster_api.py
示例3: test_cluster_get_all_show_deleted
def test_cluster_get_all_show_deleted(self):
clusters = [shared.create_cluster(self.ctx, self.profile)
for x in range(3)]
results = db_api.cluster_get_all(self.ctx)
self.assertEqual(3, len(results))
db_api.cluster_delete(self.ctx, clusters[0].id)
results = db_api.cluster_get_all(self.ctx)
self.assertEqual(2, len(results))
results = db_api.cluster_get_all(self.ctx, show_deleted=True)
self.assertEqual(3, len(results))
开发者ID:Alzon,项目名称:senlin,代码行数:13,代码来源:test_cluster_api.py
示例4: test_cluster_get_all_marker
def test_cluster_get_all_marker(self):
clusters = [shared.create_cluster(self.ctx, self.profile,
created_time=tu.utcnow())
for x in range(3)]
cl_db = db_api.cluster_get_all(self.ctx, marker=clusters[1].id)
self.assertEqual(1, len(cl_db))
self.assertEqual(clusters[2].id, cl_db[0].id)
开发者ID:Alzon,项目名称:senlin,代码行数:7,代码来源:test_cluster_api.py
示例5: test_cluster_get_all_show_nested
def test_cluster_get_all_show_nested(self):
cluster1 = shared.create_cluster(self.ctx, self.profile,
name='cluster1')
cluster2 = shared.create_cluster(self.ctx, self.profile,
name='cluster2',
parent=cluster1.id)
cl_db = db_api.cluster_get_all(self.ctx)
self.assertEqual(1, len(cl_db))
self.assertEqual(cluster1.id, cl_db[0].id)
cl_db = db_api.cluster_get_all(self.ctx, show_nested=True)
self.assertEqual(2, len(cl_db))
cl_ids = [s.id for s in cl_db]
self.assertIn(cluster1.id, cl_ids)
self.assertIn(cluster2.id, cl_ids)
开发者ID:Alzon,项目名称:senlin,代码行数:16,代码来源:test_cluster_api.py
示例6: test_cluster_get_all_returns_all_if_no_filters
def test_cluster_get_all_returns_all_if_no_filters(self):
shared.create_cluster(self.ctx, self.profile)
shared.create_cluster(self.ctx, self.profile)
filters = None
results = db_api.cluster_get_all(self.ctx, filters=filters)
self.assertEqual(2, len(results))
开发者ID:Alzon,项目名称:senlin,代码行数:8,代码来源:test_cluster_api.py
示例7: test_cluster_get_all_str_sort_keys
def test_cluster_get_all_str_sort_keys(self):
clusters = [shared.create_cluster(self.ctx, self.profile,
created_time=tu.utcnow())
for x in range(3)]
st_db = db_api.cluster_get_all(self.ctx, sort_keys='created_time')
self.assertEqual(3, len(st_db))
self.assertEqual(clusters[0].id, st_db[0].id)
self.assertEqual(clusters[1].id, st_db[1].id)
self.assertEqual(clusters[2].id, st_db[2].id)
开发者ID:Alzon,项目名称:senlin,代码行数:10,代码来源:test_cluster_api.py
示例8: test_cluster_get_all_default_sort_dir
def test_cluster_get_all_default_sort_dir(self):
clusters = [shared.create_cluster(self.ctx, self.profile,
init_time=tu.utcnow())
for x in range(3)]
st_db = db_api.cluster_get_all(self.ctx, sort_dir='asc')
self.assertEqual(3, len(st_db))
self.assertEqual(clusters[0].id, st_db[0].id)
self.assertEqual(clusters[1].id, st_db[1].id)
self.assertEqual(clusters[2].id, st_db[2].id)
开发者ID:Alzon,项目名称:senlin,代码行数:10,代码来源:test_cluster_api.py
示例9: test_cluster_get_all_with_regular_project
def test_cluster_get_all_with_regular_project(self):
values = [
{'project': UUID1},
{'project': UUID1},
{'project': UUID2},
{'project': UUID2},
{'project': UUID2},
]
[shared.create_cluster(self.ctx, self.profile, **v) for v in values]
self.ctx.project = UUID1
clusters = db_api.cluster_get_all(self.ctx)
self.assertEqual(2, len(clusters))
self.ctx.project = UUID2
clusters = db_api.cluster_get_all(self.ctx)
self.assertEqual(3, len(clusters))
self.ctx.project = UUID3
self.assertEqual([], db_api.cluster_get_all(self.ctx))
开发者ID:Alzon,项目名称:senlin,代码行数:20,代码来源:test_cluster_api.py
示例10: test_cluster_get_all_with_project_safe_false
def test_cluster_get_all_with_project_safe_false(self):
values = [
{'project': UUID1},
{'project': UUID1},
{'project': UUID2},
{'project': UUID2},
{'project': UUID2},
]
[shared.create_cluster(self.ctx, self.profile, **v) for v in values]
clusters = db_api.cluster_get_all(self.ctx, project_safe=False)
self.assertEqual(5, len(clusters))
开发者ID:Alzon,项目名称:senlin,代码行数:12,代码来源:test_cluster_api.py
示例11: test_cluster_get_all
def test_cluster_get_all(self):
values = [
{'name': 'cluster1'},
{'name': 'cluster2'},
{'name': 'cluster3'},
{'name': 'cluster4'}
]
[shared.create_cluster(self.ctx, self.profile, **v) for v in values]
ret_clusters = db_api.cluster_get_all(self.ctx)
self.assertEqual(4, len(ret_clusters))
names = [ret_cluster.name for ret_cluster in ret_clusters]
[self.assertIn(val['name'], names) for val in values]
开发者ID:Alzon,项目名称:senlin,代码行数:13,代码来源:test_cluster_api.py
示例12: test_cluster_get_all_with_admin_context
def test_cluster_get_all_with_admin_context(self):
values = [
{'project': UUID1},
{'project': UUID1},
{'project': UUID2},
{'project': UUID2},
{'project': UUID2},
]
[shared.create_cluster(self.ctx, self.profile, **v) for v in values]
admin_ctx = utils.dummy_context(project='another-project',
is_admin=True)
clusters = db_api.cluster_get_all(admin_ctx, project_safe=True)
self.assertEqual(5, len(clusters))
开发者ID:onesafe,项目名称:senlin,代码行数:14,代码来源:test_cluster_api.py
示例13: test_cluster_get_all_doesnt_mutate_sort_keys
def test_cluster_get_all_doesnt_mutate_sort_keys(self):
[shared.create_cluster(self.ctx, self.profile) for x in range(3)]
sort_keys = ['id']
db_api.cluster_get_all(self.ctx, sort_keys=sort_keys)
self.assertEqual(['id'], sort_keys)
开发者ID:Alzon,项目名称:senlin,代码行数:5,代码来源:test_cluster_api.py
示例14: test_cluster_get_all_non_existing_marker
def test_cluster_get_all_non_existing_marker(self):
[shared.create_cluster(self.ctx, self.profile) for x in range(3)]
uuid = "this cluster doesn't exist"
st_db = db_api.cluster_get_all(self.ctx, marker=uuid)
self.assertEqual(3, len(st_db))
开发者ID:Alzon,项目名称:senlin,代码行数:5,代码来源:test_cluster_api.py
注:本文中的senlin.db.sqlalchemy.api.cluster_get_all函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论