提交 b516af37 编写于 作者: J jiangpengju

命令行:

1.pkgship 命令保留可选参数-packagename, -maintainer,将page设置为1,pagesize设置65535,为不可选参数,将pkgname 修改为packagename,删除maintainlevel选项,maintainer单词修改正确。
2.pkgship issue命令保留可选参数-page, -pagesize,-maintainer,-issue_type,-issue_status
默认page=1,pagesize=65535,将pkg_name修改为packagename。
3.serialize 中删除=号,page和pagesize允许的最大值为65535。
4.test_packages.py修改相应的单元测试
上级 ace3b282
......@@ -20,7 +20,7 @@ def validate_pagenum(pagenum):
Raises:
ValidationError: Test failed
"""
if pagenum <= 0 or pagenum >= 65535:
if pagenum <= 0 or pagenum > 65535:
raise ValidationError("pagenum is illegal data ")
......@@ -34,7 +34,7 @@ def validate_pagesize(pagesize):
Raises:
ValidationError: Test failed
"""
if pagesize <= 0 or pagesize >= 65535:
if pagesize <= 0 or pagesize > 65535:
raise ValidationError("pagesize is illegal data ")
......
......@@ -511,15 +511,9 @@ class AllPackageCommand(PkgshipCommand):
self.params = [('tablename', 'str', 'name of the database operated', '', 'store'),
('-remote', 'str', 'The address of the remote service',
False, 'store_true'),
('-pkgname', 'str',
('-packagename', 'str',
'Package name that needs fuzzy matching', '', 'store'),
('-maintainner', 'str', 'Maintainer\'s name', '', 'store'),
('-maintainlevel', 'str',
'Maintain the level of data', '', 'store'),
('-page', 'int',
'Need to query the data on the first few pages', 1, 'store'),
('-pagesize', 'int',
'The size of the data displayed on each page', 10, 'store')
('-maintainer', 'str', 'Maintainer\'s name', '', 'store')
]
def register(self):
......@@ -577,14 +571,14 @@ class AllPackageCommand(PkgshipCommand):
self._set_read_host(params.remote)
_url = self.read_host + \
'/packages?table_name={table_name}&query_pkg_name={pkg_name}&\
maintainner={maintainner}&maintainlevel={maintainlevel}&\
maintainner={maintainer}&maintainlevel={maintainlevel}&\
page_num={page}&page_size={pagesize}'.format(
table_name=params.tablename,
pkg_name=params.pkgname,
maintainner=params.maintainner,
maintainlevel=params.maintainlevel,
page=params.page,
pagesize=params.pagesize).replace(' ', '')
pkg_name=params.packagename,
maintainer=params.maintainer,
maintainlevel='',
page=1,
pagesize=65535).replace(' ', '')
try:
response = requests.get(_url)
except ConnErr as conn_error:
......@@ -600,9 +594,6 @@ class AllPackageCommand(PkgshipCommand):
print(response.text)
if getattr(self.table, 'rowcount'):
print('total count : %d' % response_data['total_count'])
print('total page : %d' % response_data['total_page'])
print('current page : %s ' % params.page)
print(self.table)
else:
print('Sorry, no relevant information has been found yet')
......@@ -1382,7 +1373,7 @@ class IssueCommand(PkgshipCommand):
self.parse = PkgshipCommand.subparsers.add_parser(
'issue', help='Query the issue list of the specified package')
self.params = [
('-pkg_name', 'str', 'Query source package name', '', 'store'),
('-packagename', 'str', 'Query source package name', '', 'store'),
('-issue_type', 'str', 'Type of issue', '', 'store'),
('-issue_status', 'str', 'the status of the issue', '', 'store'),
......@@ -1390,7 +1381,7 @@ class IssueCommand(PkgshipCommand):
('-page', 'int',
'Need to query the data on the first few pages', 1, 'store'),
('-pagesize', 'int',
'The size of the data displayed on each page', 100, 'store'),
'The size of the data displayed on each page', 65535, 'store'),
('-remote', 'str', 'The address of the remote service', False, 'store_true')
]
self.table = self.create_table(
......@@ -1448,7 +1439,7 @@ class IssueCommand(PkgshipCommand):
&issue_status={issue_status}&maintainer={maintainer}'\
.format(page_num=params.page,
page_size=params.pagesize,
pkg_name=params.pkg_name,
pkg_name=params.packagename,
issue_type=params.issue_type,
issue_status=params.issue_status,
maintainer=params.maintainer).replace(' ', '')
......
......@@ -172,7 +172,7 @@ class TestPackages(ReadTestBase):
# test wrong page_num
resp = self.client.get(
"/packages?table_name=mainline&page_num=65535&page_size=1")
"/packages?table_name=mainline&page_num=65536&page_size=1")
resp_dict = json.loads(resp.data)
self.assertIn("code", resp_dict, msg="Error in data format return")
......@@ -216,7 +216,7 @@ class TestPackages(ReadTestBase):
# test wrong page_size
resp = self.client.get(
"/packages?table_name=mainline&page_num=1&page_size=65535")
"/packages?table_name=mainline&page_num=1&page_size=65536")
resp_dict = json.loads(resp.data)
self.assertIn("code", resp_dict, msg="Error in data format return")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册