def create(request, values): """ *** It always report - ValueError: invalid literal for int() with base 10: '' *** Description: Creates a new Test Case Run object and stores it in the database. Params: $values - Hash: A reference to a hash with keys and values matching the fields of the test case to be created. +--------------------+----------------+-----------+------------------------------------------------+ | Field | Type | Null | Description | +--------------------+----------------+-----------+------------------------------------------------+ | run | Integer | Required | ID of Test Run | | case | Integer | Required | ID of test case | | build | Integer | Required | ID of a Build in plan's product | | assignee | Integer | Optional | ID of assignee | | case_run_status | Integer | Optional | Defaults to "IDLE" | | case_text_version | Integer | Optional | Default to latest case text version | | notes | String | Optional | | | sortkey | Integer | Optional | a.k.a. Index, Default to 0 | +--------------------+----------------+-----------+------------------------------------------------+ Returns: The newly created object hash. Example: # Minimal test case parameters >>> values = { 'run': 1990, 'case': 12345, 'build': 123, } >>> TestCaseRun.create(values) """ from tcms.core import forms from tcms.testruns.forms import XMLRPCNewCaseRunForm form = XMLRPCNewCaseRunForm(values) if not isinstance(values, dict): raise TypeError('Argument values must be in dict type.') if not values: raise ValueError('Argument values is empty.') if form.is_valid(): tr = form.cleaned_data['run'] tcr = tr.add_case_run( case=form.cleaned_data['case'], build=form.cleaned_data['build'], assignee=form.cleaned_data['assignee'], case_run_status=form.cleaned_data['case_run_status'], case_text_version=form.cleaned_data['case_text_version'], notes=form.cleaned_data['notes'], sortkey=form.cleaned_data['sortkey']) else: raise ValueError(forms.errors_to_list(form)) return tcr.serialize()
def create(request, values): """Creates a new Test Case Run object and stores it in the database. :param dict values: a mapping containing these data to create a case run. * run: (int) **Required** ID of Test Run * case: (int) **Required** ID of test case * build: (int) **Required** ID of a Build in plan's product * assignee: (int) optional ID of assignee * case_run_status: (int) optional Defaults to "IDLE" * case_text_version: (int) optional Default to latest case text version * notes: (str) optional * sortkey: (int) optional a.k.a. Index, Default to 0 :return: a mapping representing a newly created case run. :rtype: dict Example:: # Minimal test case parameters >>> values = { 'run': 1990, 'case': 12345, 'build': 123, } >>> TestCaseRun.create(values) """ from tcms.core import forms from tcms.testruns.forms import XMLRPCNewCaseRunForm form = XMLRPCNewCaseRunForm(values) if not isinstance(values, dict): raise TypeError('Argument values must be in dict type.') if not values: raise ValueError('Argument values is empty.') if form.is_valid(): tr = form.cleaned_data['run'] tcr = tr.add_case_run( case=form.cleaned_data['case'], build=form.cleaned_data['build'], assignee=form.cleaned_data['assignee'], case_run_status=form.cleaned_data['case_run_status'], case_text_version=form.cleaned_data['case_text_version'], notes=form.cleaned_data['notes'], sortkey=form.cleaned_data['sortkey'] ) else: raise ValueError(forms.errors_to_list(form)) return tcr.serialize()
def create(request, values): """Creates a new Test Case Run object and stores it in the database. :param dict values: a mapping containing these data to create a case run. * run: (int) **Required** ID of Test Run * case: (int) **Required** ID of test case * build: (int) **Required** ID of a Build in plan's product * assignee: (int) optional ID of assignee * case_run_status: (int) optional Defaults to "IDLE" * case_text_version: (int) optional Default to latest case text version * notes: (str) optional * sortkey: (int) optional a.k.a. Index, Default to 0 :return: a mapping representing a newly created case run. :rtype: dict Example:: # Minimal test case parameters values = { 'run': 1990, 'case': 12345, 'build': 123, } TestCaseRun.create(values) """ from tcms.core import forms from tcms.testruns.forms import XMLRPCNewCaseRunForm form = XMLRPCNewCaseRunForm(values) if not isinstance(values, dict): raise TypeError('Argument values must be in dict type.') if not values: raise ValueError('Argument values is empty.') if form.is_valid(): tr = form.cleaned_data['run'] tcr = tr.add_case_run( case=form.cleaned_data['case'], build=form.cleaned_data['build'], assignee=form.cleaned_data['assignee'], case_run_status=form.cleaned_data['case_run_status'], case_text_version=form.cleaned_data['case_text_version'], notes=form.cleaned_data['notes'], sortkey=form.cleaned_data['sortkey'] ) else: raise ValueError(forms.errors_to_list(form)) return tcr.serialize()
def create(request, values): """ *** It always report - ValueError: invalid literal for int() with base 10: '' *** Description: Creates a new Test Case Run object and stores it in the database. Params: $values - Hash: A reference to a hash with keys and values matching the fields of the test case to be created. +--------------------+----------------+-----------+------------------------------------------------+ | Field | Type | Null | Description | +--------------------+----------------+-----------+------------------------------------------------+ | run | Integer | Required | ID of Test Run | | case | Integer | Required | ID of test case | | build | Integer | Required | ID of a Build in plan's product | | assignee | Integer | Optional | ID of assignee | | case_run_status | Integer | Optional | Defaults to "IDLE" | | case_text_version | Integer | Optional | Default to latest case text version | | notes | String | Optional | | | sortkey | Integer | Optional | a.k.a. Index, Default to 0 | +--------------------+----------------+-----------+------------------------------------------------+ Returns: The newly created object hash. Example: # Minimal test case parameters >>> values = { 'run': 1990, 'case': 12345, 'build': 123, } >>> TestCaseRun.create(values) """ from tcms.core import forms from tcms.testruns.forms import XMLRPCNewCaseRunForm form = XMLRPCNewCaseRunForm(values) if form.is_valid(): tr = form.cleaned_data['run'] tcr = tr.add_case_run( case=form.cleaned_data['case'], build=form.cleaned_data['build'], assignee=form.cleaned_data['assignee'], case_run_status=form.cleaned_data['case_run_status'], case_text_version=form.cleaned_data['case_text_version'], notes=form.cleaned_data['notes'], sortkey=form.cleaned_data['sortkey'] ) else: raise ValueError(forms.errors_to_list(form)) return tcr.serialize()
def create(values): """ .. function:: XML-RPC TestCaseRun.create(values) Create new TestCaseRun object and store it in the database. :param values: Field values for :class:`tcms.testruns.models.TestCaseRun` :type values: dict :return: Serialized :class:`tcms.testruns.models.TestCaseRun` object :raises: PermissionDenied if missing *testruns.add_testcaserun* permission Minimal parameters:: >>> values = { 'run': 1990, 'case': 12345, 'build': 123, } >>> TestCaseRun.create(values) """ from tcms.testruns.forms import XMLRPCNewCaseRunForm form = XMLRPCNewCaseRunForm(values) if not isinstance(values, dict): raise TypeError('Argument values must be in dict type.') if not values: raise ValueError('Argument values is empty.') if form.is_valid(): tr = form.cleaned_data['run'] tcr = tr.add_case_run( case=form.cleaned_data['case'], build=form.cleaned_data['build'], assignee=form.cleaned_data['assignee'], case_run_status=form.cleaned_data['case_run_status'], case_text_version=form.cleaned_data['case_text_version'], notes=form.cleaned_data['notes'], sortkey=form.cleaned_data['sortkey'] ) else: raise ValueError(form_errors_to_list(form)) return tcr.serialize()