Skip to content

Commit

Permalink
Remove XMLRPC from form names. Refs kiwitcms#682
Browse files Browse the repository at this point in the history
- `XMLRPCUpdateCaseForm` -> `UpdateForm`
- `XMLRPCNewRunForm` -> `NewForm`
- `XMLRPCUpdateRunForm` -> `UpdateForm`
- `XMLRPCNewExecutionForm` -> `NewExecutionForm`
- `XMLRPCUpdateExecutionForm` -> `UpdateExecutionForm`
  • Loading branch information
asankov committed Nov 24, 2019
1 parent acb2d29 commit f65288e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion tcms/rpc/api/forms/testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from tcms.testcases.models import Category


class XMLRPCUpdateCaseForm(BaseCaseForm):
class UpdateForm(BaseCaseForm):
summary = forms.CharField(
required=False,
)
Expand Down
8 changes: 4 additions & 4 deletions tcms/rpc/api/forms/testrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
User = get_user_model() # pylint: disable=invalid-name


class XMLRPCNewRunForm(BaseRunForm):
class NewForm(BaseRunForm):
plan = forms.ModelChoiceField(
queryset=TestPlan.objects.none(),
)
Expand All @@ -24,7 +24,7 @@ def assign_plan(self, plan_id):
self.populate(self.fields['plan'].queryset.first().product_id)


class XMLRPCUpdateRunForm(XMLRPCNewRunForm):
class UpdateForm(NewForm):
plan = forms.ModelChoiceField(
queryset=TestPlan.objects.all(),
required=False,
Expand Down Expand Up @@ -59,7 +59,7 @@ def clean_status(self):
return self.cleaned_data.get('status')


class XMLRPCNewExecutionForm(BaseCaseRunForm):
class NewExecutionForm(BaseCaseRunForm):
assignee = forms.ModelChoiceField(queryset=User.objects.all(), required=False)
run = forms.ModelChoiceField(queryset=TestRun.objects.all())
case = forms.ModelChoiceField(queryset=TestCase.objects.all())
Expand Down Expand Up @@ -91,6 +91,6 @@ def clean_status(self):
return data


class XMLRPCUpdateExecutionForm(BaseCaseRunForm):
class UpdateExecutionForm(BaseCaseRunForm):
assignee = forms.ModelChoiceField(queryset=User.objects.all(), required=False)
build = forms.ModelChoiceField(queryset=Build.objects.all(), required=False)
4 changes: 2 additions & 2 deletions tcms/rpc/api/testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from tcms.management.models import Component
from tcms.testcases.models import TestCase
from tcms.testcases.forms import NewCaseForm
from tcms.rpc.api.forms.testcase import XMLRPCUpdateCaseForm
from tcms.rpc.api.forms.testcase import UpdateForm

from tcms.rpc import utils
from tcms.rpc.decorators import permissions_required
Expand Down Expand Up @@ -320,7 +320,7 @@ def update(case_id, values):
:raises: TestCase.DoesNotExist if object specified by PK doesn't exist
:raises: PermissionDenied if missing *testcases.change_testcase* permission
"""
form = XMLRPCUpdateCaseForm(values)
form = UpdateForm(values)

if values.get('category') and not values.get('product'):
raise ValueError('Product ID is required for category')
Expand Down
4 changes: 2 additions & 2 deletions tcms/rpc/api/testexecution.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def create(values):
>>> TestExecution.create(values)
"""

form = XMLRPCNewExecutionForm(values)
form = NewExecutionForm(values)

if not isinstance(values, dict):
raise TypeError('Argument values must be in dict type.')
Expand Down Expand Up @@ -127,7 +127,7 @@ def update(case_run_id, values, **kwargs):
"""

tcr = TestExecution.objects.get(pk=case_run_id)
form = XMLRPCUpdateExecutionForm(values)
form = UpdateExecutionForm(values)

if form.is_valid():
if form.cleaned_data['build']:
Expand Down
6 changes: 3 additions & 3 deletions tcms/rpc/api/testrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from tcms.testruns.models import TestExecution
from tcms.testruns.models import TestRun
from tcms.rpc.decorators import permissions_required
from tcms.rpc.api.forms.testrun import XMLRPCUpdateRunForm, XMLRPCNewRunForm
from tcms.rpc.api.forms.testrun import UpdateForm, NewForm


__all__ = (
Expand Down Expand Up @@ -161,7 +161,7 @@ def create(values):
}
>>> TestRun.create(values)
"""
form = XMLRPCNewRunForm(values)
form = NewForm(values)
form.assign_plan(values.get('plan'))

if form.is_valid():
Expand Down Expand Up @@ -218,7 +218,7 @@ def update(run_id, values):
if values.get('product_version') and not values.get('product'):
raise ValueError('Field "product" is required by product_version')

form = XMLRPCUpdateRunForm(values)
form = UpdateForm(values)
if values.get('product_version'):
form.populate(product_id=values['product'])

Expand Down

0 comments on commit f65288e

Please sign in to comment.