本文整理汇总了Python中models.package_version.PackageVersion.get_by_name_and_version方法的典型用法代码示例。如果您正苦于以下问题:Python PackageVersion.get_by_name_and_version方法的具体用法?Python PackageVersion.get_by_name_and_version怎么用?Python PackageVersion.get_by_name_and_version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.package_version.PackageVersion
的用法示例。
在下文中一共展示了PackageVersion.get_by_name_and_version方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_reload_preserves_sort_order
# 需要导入模块: from models.package_version import PackageVersion [as 别名]
# 或者: from models.package_version.PackageVersion import get_by_name_and_version [as 别名]
def test_reload_preserves_sort_order(self):
self.be_admin_user()
self.post_package_version("1.2.3")
self.post_package_version("1.2.4")
self.post_package_version("1.2.4-pre")
self.testapp.post("/packages/versions/reload")
self.run_deferred_tasks()
version = PackageVersion.get_by_name_and_version("test-package", "1.2.3")
self.assertEqual(0, version.sort_order)
version = PackageVersion.get_by_name_and_version("test-package", "1.2.4-pre")
self.assertEqual(1, version.sort_order)
version = PackageVersion.get_by_name_and_version("test-package", "1.2.4")
self.assertEqual(2, version.sort_order)
示例2: test_reload_preserves_downloads
# 需要导入模块: from models.package_version import PackageVersion [as 别名]
# 或者: from models.package_version.PackageVersion import get_by_name_and_version [as 别名]
def test_reload_preserves_downloads(self):
self.be_admin_user()
self.post_package_version("1.2.3")
response = self.testapp.get("/packages/test-package/versions/1.2.3.tar.gz")
self.testapp.post("/packages/versions/reload")
self.run_deferred_tasks()
version = PackageVersion.get_by_name_and_version("test-package", "1.2.3")
self.assertEqual(1, version.downloads)
示例3: test_reload_reloads_a_package_version
# 需要导入模块: from models.package_version import PackageVersion [as 别名]
# 或者: from models.package_version.PackageVersion import get_by_name_and_version [as 别名]
def test_reload_reloads_a_package_version(self):
self.be_admin_user()
self.post_package_version("1.2.3")
version = PackageVersion.get_by_name_and_version("test-package", "1.2.3")
version.libraries = ["wrong"]
version.put()
response = self.testapp.post("/packages/versions/reload", status=302)
self.assertEqual(response.headers["Location"], "http://localhost:80/admin#tab-packages")
self.run_deferred_tasks()
version = PackageVersion.get_by_name_and_version("test-package", "1.2.3")
self.assertEqual([], version.libraries)
# The latest_version of the parent package should also be updated
version = Package.get_by_key_name("test-package").latest_version
self.assertEqual([], version.libraries)
self.assert_package_updated_is_latest_version_created()
示例4: test_reload_preserves_sort_order
# 需要导入模块: from models.package_version import PackageVersion [as 别名]
# 或者: from models.package_version.PackageVersion import get_by_name_and_version [as 别名]
def test_reload_preserves_sort_order(self):
self.be_admin_oauth_user()
self.post_package_version('1.2.3')
self.post_package_version('1.2.4')
self.post_package_version('1.2.4-pre')
self.be_admin_user()
self.testapp.post('/packages/versions/reload')
self.run_deferred_tasks()
version = PackageVersion.get_by_name_and_version(
'test-package', '1.2.3')
self.assertEqual(0, version.sort_order)
version = PackageVersion.get_by_name_and_version(
'test-package', '1.2.4-pre')
self.assertEqual(1, version.sort_order)
version = PackageVersion.get_by_name_and_version(
'test-package', '1.2.4')
self.assertEqual(2, version.sort_order)
示例5: test_reload_preserves_downloads
# 需要导入模块: from models.package_version import PackageVersion [as 别名]
# 或者: from models.package_version.PackageVersion import get_by_name_and_version [as 别名]
def test_reload_preserves_downloads(self):
self.be_admin_oauth_user()
self.post_package_version('1.2.3')
response = self.testapp.get(
'/packages/test-package/versions/1.2.3.tar.gz')
self.be_admin_user()
self.testapp.post('/packages/versions/reload')
self.run_deferred_tasks()
version = PackageVersion.get_by_name_and_version(
'test-package', '1.2.3')
self.assertEqual(1, version.downloads)
示例6: package_version
# 需要导入模块: from models.package_version import PackageVersion [as 别名]
# 或者: from models.package_version.PackageVersion import get_by_name_and_version [as 别名]
def package_version(self, version):
"""Load the current package version object.
This auto-detects the package name from the request parameters. If the
package version doesn't exist, throws a 404 error.
"""
if self._package_version: return self._package_version
package_name = self.request.params['package_id']
if not package_name:
http_error(403, "No package name found.")
self._package_version = PackageVersion.get_by_name_and_version(
package_name, version)
if self._package_version: return self._package_version
http_error(404, "\"%s\" version %s doesn't exist." %
(package_name, version))
示例7: setUp
# 需要导入模块: from models.package_version import PackageVersion [as 别名]
# 或者: from models.package_version.PackageVersion import get_by_name_and_version [as 别名]
def setUp(self):
super(SearchTest, self).setUp()
self.be_admin_user()
packages = [
"armadillo", "bandicoot", "cat", "dog", "elephant",
"fox", "gorilla", "hippo", "iguana", "jackal",
"kangaroo", "lemur"
]
for package in packages:
self.create_package(package, "1.0.0")
packageVersion = PackageVersion.get_by_name_and_version(
package, "1.0.0")
packageVersion.pubspec.update(
description="Description for " + package)
packageVersion.put()
self.be_normal_user()
示例8: get_package_version
# 需要导入模块: from models.package_version import PackageVersion [as 别名]
# 或者: from models.package_version.PackageVersion import get_by_name_and_version [as 别名]
def get_package_version(self, version):
return PackageVersion.get_by_name_and_version('test-package', version)