From e0b36b66b4fe0f93fff448a5cce11dfa627adc52 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 07 2014 10:08:21 +0000 Subject: pkgname -> pkgnames where more than one package name can be specified --- diff --git a/pkgdb2/api/packages.py b/pkgdb2/api/packages.py index d04777c..94662c4 100644 --- a/pkgdb2/api/packages.py +++ b/pkgdb2/api/packages.py @@ -194,7 +194,7 @@ Orphan package ) if form.validate_on_submit(): - pkg_names = form.pkgname.data.split(',') + pkg_names = form.pkgnames.data.split(',') pkg_branchs = form.branches.data.split(',') try: @@ -247,7 +247,7 @@ Unorphan packages Accept POST queries only. - :arg pkgname: Comma separated list of string of the packages name. + :arg pkgnames: Comma separated list of string of the packages name. :arg branches: Comma separated list of string of the branches name in which these packages will be unorphaned. :arg poc: String of the name of the user taking ownership of @@ -277,7 +277,7 @@ Unorphan packages ) if form.validate_on_submit(): - pkg_names = form.pkgname.data.split(',') + pkg_names = form.pkgnames.data.split(',') pkg_branchs = form.branches.data.split(',') pkg_poc = form.poc.data @@ -331,7 +331,7 @@ Retire packages Accept POST queries only. - :arg pkgname: Comma separated list of string of the packages name. + :arg pkgnames: Comma separated list of string of the packages name. :arg branches: Comma separated list of string of the branches name in which these packages will be retire. @@ -357,7 +357,7 @@ Retire packages form = forms.DeprecatePackageForm(csrf_enabled=False) if form.validate_on_submit(): - pkg_names = form.pkgname.data.split(',') + pkg_names = form.pkgnames.data.split(',') pkg_branchs = form.branches.data.split(',') try: @@ -410,7 +410,7 @@ Unretire packages Accept POST queries only. - :arg pkgname: Comma separated list of the packages names. + :arg pkgnames: Comma separated list of the packages names. :arg branches: Comma separated list of string of the branches names in which these packages will be un-deprecated. @@ -437,7 +437,7 @@ Unretire packages form = forms.DeprecatePackageForm(csrf_enabled=False) if form.validate_on_submit(): - pkg_names = form.pkgname.data.split(',') + pkg_names = form.pkgnames.data.split(',') pkg_branchs = form.branches.data.split(',') try: diff --git a/pkgdb2/forms.py b/pkgdb2/forms.py index 923ea72..64f5a60 100644 --- a/pkgdb2/forms.py +++ b/pkgdb2/forms.py @@ -302,7 +302,7 @@ class UpdateAclPackageForm(wtf.Form): class PackageOwnerForm(wtf.Form): """ Form to change the point of contact of a package. """ - pkgname = wtforms.TextField( + pkgnames = wtforms.TextField( 'Package name', [wtforms.validators.Required()] ) @@ -318,7 +318,7 @@ class PackageOwnerForm(wtf.Form): class DeprecatePackageForm(wtf.Form): """ Form to deprecate a package. """ - pkgname = wtforms.TextField( + pkgnames = wtforms.TextField( 'Package name', [wtforms.validators.Required()] ) diff --git a/tests/test_flask_api_packages.py b/tests/test_flask_api_packages.py index 3c2c2dc..1ab2d0f 100644 --- a/tests/test_flask_api_packages.py +++ b/tests/test_flask_api_packages.py @@ -245,7 +245,7 @@ class FlaskApiPackagesTest(Modeltests): { "error": "Invalid input submitted", "error_detail": [ - "pkgname: This field is required.", + "pkgnames: This field is required.", "branches: This field is required.", ], "output": "notok" @@ -253,7 +253,7 @@ class FlaskApiPackagesTest(Modeltests): ) data = { - 'pkgname': 'guake', + 'pkgnames': 'guake', 'branches': 'F-18,devel', 'poc': 'test', } @@ -273,7 +273,7 @@ class FlaskApiPackagesTest(Modeltests): mock_func.log.return_value = '' data = { - 'pkgname': 'guake', + 'pkgnames': 'guake', 'branches': 'F-18,devel', 'poc': 'test', } @@ -323,7 +323,7 @@ class FlaskApiPackagesTest(Modeltests): { "error": "Invalid input submitted", "error_detail": [ - "pkgname: This field is required.", + "pkgnames: This field is required.", "branches: This field is required.", "poc: This field is required.", ], @@ -332,7 +332,7 @@ class FlaskApiPackagesTest(Modeltests): ) data = { - 'pkgname': 'guake', + 'pkgnames': 'guake', 'branches': 'F-18,devel', 'poc': 'test', } @@ -353,7 +353,7 @@ class FlaskApiPackagesTest(Modeltests): # Unorphan a not-orphaned package data = { - 'pkgname': 'guake', + 'pkgnames': 'guake', 'branches': 'F-18,devel', 'poc': 'test', } @@ -371,7 +371,7 @@ class FlaskApiPackagesTest(Modeltests): # Orphan the package data = { - 'pkgname': 'guake', + 'pkgnames': 'guake', 'branches': 'F-18,devel', 'poc': 'test', } @@ -399,7 +399,7 @@ class FlaskApiPackagesTest(Modeltests): # Unorphan the package for someone else data = { - 'pkgname': 'guake', + 'pkgnames': 'guake', 'branches': 'F-18,devel', 'poc': 'test', } @@ -418,7 +418,7 @@ class FlaskApiPackagesTest(Modeltests): # Unorphan the package data = { - 'pkgname': 'guake', + 'pkgnames': 'guake', 'branches': 'F-18,devel', 'poc': 'pingou', } @@ -472,7 +472,7 @@ class FlaskApiPackagesTest(Modeltests): { "error": "Invalid input submitted", "error_detail": [ - "pkgname: This field is required.", + "pkgnames: This field is required.", "branches: This field is required.", ], "output": "notok" @@ -480,7 +480,7 @@ class FlaskApiPackagesTest(Modeltests): ) data = { - 'pkgname': 'guake', + 'pkgnames': 'guake', 'branches': 'F-18,devel', 'poc': 'test', } @@ -501,7 +501,7 @@ class FlaskApiPackagesTest(Modeltests): # User is not an admin data = { - 'pkgname': 'guake', + 'pkgnames': 'guake', 'branches': 'F-18,devel', } with user_set(pkgdb2.APP, user): @@ -521,7 +521,7 @@ class FlaskApiPackagesTest(Modeltests): # Retire the package user = FakeFasUserAdmin() data = { - 'pkgname': 'guake', + 'pkgnames': 'guake', 'branches': 'F-18,devel', } with user_set(pkgdb2.APP, user): @@ -560,7 +560,7 @@ class FlaskApiPackagesTest(Modeltests): { "error": "Invalid input submitted", "error_detail": [ - "pkgname: This field is required.", + "pkgnames: This field is required.", "branches: This field is required.", ], "output": "notok" @@ -568,7 +568,7 @@ class FlaskApiPackagesTest(Modeltests): ) data = { - 'pkgname': 'guake', + 'pkgnames': 'guake', 'branches': 'F-18,devel', 'poc': 'test', } @@ -589,7 +589,7 @@ class FlaskApiPackagesTest(Modeltests): # User is not an admin data = { - 'pkgname': 'guake', + 'pkgnames': 'guake', 'branches': 'F-18,devel', } with user_set(pkgdb2.APP, user): @@ -609,7 +609,7 @@ class FlaskApiPackagesTest(Modeltests): # Unretire the package user = FakeFasUserAdmin() data = { - 'pkgname': 'guake', + 'pkgnames': 'guake', 'branches': 'F-18,devel', } with user_set(pkgdb2.APP, user):