本文整理汇总了Python中murano.db.catalog.api.package_upload函数的典型用法代码示例。如果您正苦于以下问题:Python package_upload函数的具体用法?Python package_upload怎么用?Python package_upload使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了package_upload函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_class_name_is_unique
def test_class_name_is_unique(self):
value = self._stub_package(class_definitions=('foo', 'bar'))
api.package_upload(value, self.tenant_id)
value = self._stub_package(class_definitions=('bar', 'baz'),
fully_qualified_name='com.example.package2')
self.assertRaises(exc.HTTPConflict, api.package_upload, value,
self.tenant_id)
开发者ID:Aqsamm,项目名称:murano,代码行数:7,代码来源:test_catalog.py
示例2: test_package_fqn_is_unique
def test_package_fqn_is_unique(self):
self._create_categories()
values = self._stub_package()
api.package_upload(values, self.tenant_id)
self.assertRaises(db_exception.DBDuplicateEntry,
api.package_upload, values, self.tenant_id)
开发者ID:Aqsamm,项目名称:murano,代码行数:7,代码来源:test_catalog.py
示例3: test_class_name_public_public_violation
def test_class_name_public_public_violation(self):
value = self._stub_package(class_definitions=("foo", "bar"), is_public=True)
api.package_upload(value, self.tenant_id)
value = self._stub_package(
class_definitions=("foo", "bar"), is_public=True, fully_qualified_name="com.example.package2"
)
self.assertRaises(exc.HTTPConflict, api.package_upload, value, self.tenant_id_2)
开发者ID:NikolayStarodubtsev,项目名称:murano,代码行数:7,代码来源:test_catalog.py
示例4: test_packages_filter_by_id
def test_packages_filter_by_id(self):
"""GET /catalog/packages with parameter "id" returns packages
filtered by id.
"""
self._set_policy_rules(
{'get_package': '',
'manage_public_package': ''}
)
_, package1_data = self._test_package()
_, package2_data = self._test_package()
package1_data['fully_qualified_name'] += '_1'
package1_data['name'] += '_1'
package1_data['class_definitions'] = (u'test.mpl.v1.app.Thing1',)
package2_data['fully_qualified_name'] += '_2'
package2_data['name'] += '_2'
package2_data['class_definitions'] = (u'test.mpl.v1.app.Thing2',)
expected_package = db_catalog_api.package_upload(package1_data, '')
db_catalog_api.package_upload(package2_data, '')
req = self._get('/catalog/packages',
params={'id': expected_package.id})
self.expect_policy_check('get_package')
self.expect_policy_check('manage_public_package')
res = req.get_response(self.api)
self.assertEqual(200, res.status_code)
self.assertEqual(1, len(res.json['packages']))
found_package = res.json['packages'][0]
self.assertEqual(expected_package.id, found_package['id'])
开发者ID:Aqsamm,项目名称:murano,代码行数:34,代码来源:test_catalog.py
示例5: test_package_search_search
def test_package_search_search(self):
pkg1 = api.package_upload(
self._stub_package(
fully_qualified_name=str(uuid.uuid4())), self.tenant_id)
pkg2 = api.package_upload(
self._stub_package(
tags=[],
fully_qualified_name=str(uuid.uuid4())), self.tenant_id)
res = api.package_search(
{'search': 'tag1'}, self.context)
self.assertEqual(1, len(res))
res = api.package_search(
{'search': pkg1.fully_qualified_name}, self.context)
self.assertEqual(1, len(res))
res = api.package_search(
{'search': pkg2.fully_qualified_name}, self.context)
self.assertEqual(1, len(res))
res = api.package_search(
{'search': 'not_a_valid_uuid'}, self.context)
self.assertEqual(0, len(res))
res = api.package_search(
{'search': 'some text'}, self.context)
self.assertEqual(2, len(res))
开发者ID:Aqsamm,项目名称:murano,代码行数:25,代码来源:test_catalog.py
示例6: test_pagination_loops_through_names
def test_pagination_loops_through_names(self):
"""Tests that packages with same display name are not skipped
Creates 10 packages with the same display name and iterates
through them, checking that package are not skipped.
"""
for dummy in range(10):
api.package_upload(
self._stub_package(name='test',
fully_qualified_name=str(uuid.uuid4())),
self.tenant_id)
res = api.package_search({}, self.context, limit=4)
self.assertEqual(4, len(res))
marker = res[-1].id
res = api.package_search({'marker': marker}, self.context, limit=4)
self.assertEqual(4, len(res))
marker = res[-1].id
res = api.package_search({'marker': marker}, self.context, limit=4)
self.assertEqual(2, len(res))
marker = res[-1].id
res = api.package_search({'marker': marker}, self.context, limit=4)
self.assertEqual(0, len(res))
开发者ID:AleptNamrata,项目名称:murano,代码行数:26,代码来源:test_catalog.py
示例7: test_package_update_public_public_fqn_violation
def test_package_update_public_public_fqn_violation(self):
id1 = api.package_upload(self._stub_package(), self.tenant_id).id
id2 = api.package_upload(self._stub_package(), self.tenant_id_2).id
patch = self.get_change('replace', ['is_public'], True)
api.package_update(id1, [patch], self.context)
self.assertRaises(exc.HTTPConflict, api.package_update,
id2, [patch], self.context_2)
开发者ID:Aqsamm,项目名称:murano,代码行数:7,代码来源:test_catalog.py
示例8: test_class_name_private_public_no_violation
def test_class_name_private_public_no_violation(self):
value = self._stub_package(class_definitions=("foo", "bar"), is_public=False)
api.package_upload(value, self.tenant_id)
value = self._stub_package(
class_definitions=("foo", "bar"), is_public=True, fully_qualified_name="com.example.package2"
)
api.package_upload(value, self.tenant_id_2)
开发者ID:NikolayStarodubtsev,项目名称:murano,代码行数:7,代码来源:test_catalog.py
示例9: test_package_search_owned
def test_package_search_owned(self):
api.package_upload(self._stub_package(is_public=True, fully_qualified_name=str(uuid.uuid4())), self.tenant_id)
api.package_upload(self._stub_package(is_public=True, fully_qualified_name=str(uuid.uuid4())), self.tenant_id_2)
res = api.package_search({"owned": "true"}, self.context_admin)
self.assertEqual(1, len(res))
res = api.package_search({"owned": "false"}, self.context_admin)
self.assertEqual(2, len(res))
开发者ID:NikolayStarodubtsev,项目名称:murano,代码行数:8,代码来源:test_catalog.py
示例10: test_package_update_public_public_class_name_violation
def test_package_update_public_public_class_name_violation(self):
id1 = api.package_upload(self._stub_package(class_definitions=("foo", "bar")), self.tenant_id).id
id2 = api.package_upload(
self._stub_package(class_definitions=("foo", "bar"), fully_qualified_name="com.example.package2"),
self.tenant_id_2,
).id
patch = self.get_change("replace", ["is_public"], True)
api.package_update(id1, [patch], self.context)
self.assertRaises(exc.HTTPConflict, api.package_update, id2, [patch], self.context_2)
开发者ID:NikolayStarodubtsev,项目名称:murano,代码行数:9,代码来源:test_catalog.py
示例11: test_package_update_public_public_class_name_violation
def test_package_update_public_public_class_name_violation(self):
id1 = api.package_upload(self._stub_package(
class_definitions=('foo', 'bar')), self.tenant_id).id
id2 = api.package_upload(self._stub_package(
class_definitions=('foo', 'bar'),
fully_qualified_name='com.example.package2'), self.tenant_id_2).id
patch = self.get_change('replace', ['is_public'], True)
api.package_update(id1, [patch], self.context)
self.assertRaises(exc.HTTPConflict, api.package_update,
id2, [patch], self.context_2)
开发者ID:Aqsamm,项目名称:murano,代码行数:10,代码来源:test_catalog.py
示例12: test_package_search_type
def test_package_search_type(self):
api.package_upload(
self._stub_package(type="Application", fully_qualified_name=str(uuid.uuid4())), self.tenant_id
)
api.package_upload(self._stub_package(type="Library", fully_qualified_name=str(uuid.uuid4())), self.tenant_id)
res = api.package_search({"type": "Library"}, self.context)
self.assertEqual(1, len(res))
res = api.package_search({"type": "Application"}, self.context)
self.assertEqual(1, len(res))
开发者ID:NikolayStarodubtsev,项目名称:murano,代码行数:10,代码来源:test_catalog.py
示例13: test_package_search_tags
def test_package_search_tags(self):
api.package_upload(self._stub_package(fully_qualified_name=str(uuid.uuid4())), self.tenant_id)
api.package_upload(self._stub_package(tags=[], fully_qualified_name=str(uuid.uuid4())), self.tenant_id)
res = api.package_search({"tag": ["tag1"]}, self.context)
self.assertEqual(1, len(res))
res = api.package_search({"tag": ["tag2"]}, self.context)
self.assertEqual(1, len(res))
res = api.package_search({"tag": ["tag3"]}, self.context)
self.assertEqual(0, len(res))
开发者ID:NikolayStarodubtsev,项目名称:murano,代码行数:10,代码来源:test_catalog.py
示例14: test_package_search_disabled
def test_package_search_disabled(self):
api.package_upload(
self._stub_package(is_public=True, enabled=True, fully_qualified_name=str(uuid.uuid4())), self.tenant_id
)
api.package_upload(
self._stub_package(is_public=True, enabled=False, fully_qualified_name=str(uuid.uuid4())), self.tenant_id
)
res = api.package_search({"include_disabled": "false"}, self.context)
self.assertEqual(1, len(res))
res = api.package_search({"include_disabled": "true"}, self.context)
self.assertEqual(2, len(res))
开发者ID:NikolayStarodubtsev,项目名称:murano,代码行数:12,代码来源:test_catalog.py
示例15: test_packages_filter_by_in_category
def test_packages_filter_by_in_category(self):
"""Test that packages are filtered by in:cat1,cat2,cat3
GET /catalog/packages with parameter "category=in:cat1,cat2,cat3"
returns packages filtered by category.
"""
names = ['cat1', 'cat2', 'cat3', 'cat4']
for name in names:
db_catalog_api.category_add(name)
self._set_policy_rules(
{'get_package': '',
'manage_public_package': ''}
)
_, package1_data = self._test_package()
_, package2_data = self._test_package()
_, package3_data = self._test_package()
package1_data['fully_qualified_name'] += '_1'
package1_data['name'] += '_1'
package1_data['class_definitions'] = (u'test.mpl.v1.app.Thing1',)
package1_data['categories'] = ('cat1', 'cat2')
package2_data['fully_qualified_name'] += '_2'
package2_data['name'] += '_2'
package2_data['class_definitions'] = (u'test.mpl.v1.app.Thing2',)
package2_data['categories'] = ('cat2', 'cat3')
package3_data['fully_qualified_name'] += '_3'
package3_data['name'] += '_3'
package3_data['class_definitions'] = (u'test.mpl.v1.app.Thing3',)
package3_data['categories'] = ('cat2', 'cat4')
expected_packages = [db_catalog_api.package_upload(package1_data, ''),
db_catalog_api.package_upload(package2_data, '')]
db_catalog_api.package_upload(package3_data, '')
categories_in = "in:cat1,cat3"
req = self._get('/catalog/packages',
params={'category': categories_in})
self.expect_policy_check('get_package')
self.expect_policy_check('manage_public_package')
res = req.get_response(self.api)
self.assertEqual(200, res.status_code)
self.assertEqual(2, len(res.json['packages']))
found_packages = res.json['packages']
self.assertEqual([pack.id for pack in expected_packages],
[pack['id'] for pack in found_packages])
开发者ID:AleptNamrata,项目名称:murano,代码行数:51,代码来源:test_catalog.py
示例16: test_package_search_owned
def test_package_search_owned(self):
api.package_upload(
self._stub_package(
is_public=True,
fully_qualified_name=str(uuid.uuid4())), self.tenant_id)
api.package_upload(
self._stub_package(
is_public=True,
fully_qualified_name=str(uuid.uuid4())), self.tenant_id_2)
res = api.package_search({'owned': 'true'}, self.context_admin)
self.assertEqual(len(res), 1)
res = api.package_search({'owned': 'false'}, self.context_admin)
self.assertEqual(len(res), 2)
开发者ID:aawm,项目名称:murano,代码行数:14,代码来源:test_catalog.py
示例17: test_package_search_no_filters_catalog
def test_package_search_no_filters_catalog(self):
res = api.package_search({}, self.context, catalog=True)
self.assertEqual(0, len(res))
api.package_upload(
self._stub_package(
is_public=True,
fully_qualified_name=str(uuid.uuid4())), self.tenant_id)
api.package_upload(
self._stub_package(
is_public=False,
fully_qualified_name=str(uuid.uuid4())), self.tenant_id)
api.package_upload(
self._stub_package(
is_public=True,
fully_qualified_name=str(uuid.uuid4())), self.tenant_id_2)
api.package_upload(
self._stub_package(
is_public=False,
fully_qualified_name=str(uuid.uuid4())), self.tenant_id_2)
# catalog=True should show public + mine
res = api.package_search({}, self.context, catalog=True)
self.assertEqual(3, len(res))
res = api.package_search({}, self.context_admin, catalog=True)
self.assertEqual(3, len(res))
开发者ID:Aqsamm,项目名称:murano,代码行数:28,代码来源:test_catalog.py
示例18: test_package_search_no_filters
def test_package_search_no_filters(self):
res = api.package_search({}, self.context)
self.assertEqual(0, len(res))
api.package_upload(
self._stub_package(
is_public=True,
fully_qualified_name=str(uuid.uuid4())), self.tenant_id)
api.package_upload(
self._stub_package(
is_public=False,
fully_qualified_name=str(uuid.uuid4())), self.tenant_id)
api.package_upload(
self._stub_package(
is_public=True,
fully_qualified_name=str(uuid.uuid4())), self.tenant_id_2)
api.package_upload(
self._stub_package(
is_public=False,
fully_qualified_name=str(uuid.uuid4())), self.tenant_id_2)
# I can only edit mine pkgs
res = api.package_search({}, self.context)
self.assertEqual(2, len(res))
for pkg in res:
self.assertEqual(self.tenant_id, pkg.owner_id)
# Admin can see everything
res = api.package_search({}, self.context_admin)
self.assertEqual(4, len(res))
开发者ID:Aqsamm,项目名称:murano,代码行数:31,代码来源:test_catalog.py
示例19: test_package_search_search
def test_package_search_search(self):
pkg1 = api.package_upload(self._stub_package(fully_qualified_name=str(uuid.uuid4())), self.tenant_id)
pkg2 = api.package_upload(self._stub_package(tags=[], fully_qualified_name=str(uuid.uuid4())), self.tenant_id)
res = api.package_search({"search": "tag1"}, self.context)
self.assertEqual(len(res), 1)
res = api.package_search({"search": pkg1.fully_qualified_name}, self.context)
self.assertEqual(len(res), 1)
res = api.package_search({"search": pkg2.fully_qualified_name}, self.context)
self.assertEqual(len(res), 1)
res = api.package_search({"search": "not_a_valid_uuid"}, self.context)
self.assertEqual(len(res), 0)
res = api.package_search({"search": "some text"}, self.context)
self.assertEqual(len(res), 2)
开发者ID:chenyujie,项目名称:hybrid-murano,代码行数:15,代码来源:test_catalog.py
示例20: test_pagination
def test_pagination(self):
"""Creates 10 packages with unique names and iterates through them,
checking that package order is correct.
"""
pkgs = []
for dummy in range(10):
package = api.package_upload(self._stub_package(
name=str(uuid.uuid4()),
fully_qualified_name=str(uuid.uuid4())), self.tenant_id)
pkgs.append(package)
# sort pkg ids by pkg name
pkg_ids = [pkg.id for pkg in sorted(pkgs, key=lambda _pkg: _pkg.name)]
res = api.package_search({}, self.context, limit=4)
self.assertEqual(4, len(res))
self.assertEqual(pkg_ids[0:4], [r.id for r in res])
marker = res[-1].id
res = api.package_search({'marker': marker}, self.context, limit=4)
self.assertEqual(4, len(res))
self.assertEqual(pkg_ids[4:8], [r.id for r in res])
marker = res[-1].id
res = api.package_search({'marker': marker}, self.context, limit=4)
self.assertEqual(2, len(res))
self.assertEqual(pkg_ids[8:10], [r.id for r in res])
marker = res[-1].id
res = api.package_search({'marker': marker}, self.context, limit=4)
self.assertEqual(0, len(res))
开发者ID:Aqsamm,项目名称:murano,代码行数:32,代码来源:test_catalog.py
注:本文中的murano.db.catalog.api.package_upload函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论