tcms.testcases.views module

class tcms.testcases.views.CloneTestCaseView(**kwargs)[source]

Bases: django.views.generic.base.View

Clone one case or multiple case into other plan or plans

dispatch(request, *args, **kwargs)
get(request)[source]
http_method_names = ['get', 'post']
post(request)[source]
template_name = 'testcases/clone.html'
class tcms.testcases.views.EditTestCaseView(**kwargs)[source]

Bases: django.views.generic.edit.UpdateView

dispatch(request, *args, **kwargs)
form_class

alias of tcms.testcases.forms.TestCaseForm

form_valid(form)[source]

If the form is valid, save the associated model.

get_context_data(**kwargs)[source]

Insert the form into the context dict.

get_form(form_class=None)[source]

Return an instance of the form to be used in this view.

get_initial()[source]

Return the initial data to use for forms on this view.

model

alias of tcms.testcases.models.TestCase

template_name = 'testcases/mutable.html'
class tcms.testcases.views.NewCaseView(**kwargs)[source]

Bases: django.views.generic.edit.CreateView

dispatch(request, *args, **kwargs)
form_class

alias of tcms.testcases.forms.TestCaseForm

form_valid(form)[source]

If the form is valid, save the associated model.

get_context_data(**kwargs)[source]

Insert the form into the context dict.

get_form(form_class=None)[source]

Return an instance of the form to be used in this view.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

model

alias of tcms.testcases.models.TestCase

template_name = 'testcases/mutable.html'
class tcms.testcases.views.SimpleTestCaseView(**kwargs)[source]

Bases: django.views.generic.base.TemplateView

Simple read-only TestCase View used in TestPlan page

get(request, *args, **kwargs)[source]
get_context_data(**kwargs)[source]
review_mode = None
template_name = 'case/get_details.html'
class tcms.testcases.views.TestCaseExecutionDetailPanelView(**kwargs)[source]

Bases: django.views.generic.base.TemplateView

Display execution detail in run page

case_text_version = None
execution_id = None
get(request, *args, **kwargs)[source]
get_context_data(**kwargs)[source]
template_name = 'case/get_details_case_run.html'
class tcms.testcases.views.TestCaseGetView(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

get_context_data(**kwargs)[source]

Insert the single object into the context dict.

http_method_names = ['get']
model

alias of tcms.testcases.models.TestCase

render_to_response(context, **response_kwargs)[source]

Return a response, using the response_class for this view, with a template rendered with the given context.

Pass response_kwargs to the constructor of the response class.

response_class

alias of tcms.core.response.ModifySettingsTemplateResponse

template_name = 'testcases/get.html'
class tcms.testcases.views.TestCaseSearchView(**kwargs)[source]

Bases: django.views.generic.base.TemplateView

Shows the search form which uses JSON RPC to fetch the results

get_context_data(**kwargs)[source]
template_name = 'testcases/search.html'
tcms.testcases.views.build_cases_search_form(request, populate=None, plan=None)[source]

Build search form preparing for quering TestCases

tcms.testcases.views.calculate_for_testcases(plan, testcases)[source]

Calculate extra data for TestCases

Attach TestCasePlan.sortkey, TestCasePlan.pk, and the number of bugs of each TestCase.

Parameters:
  • plan (tcms.testplans.models.TestPlan) – the TestPlan containing searched TestCases. None means testcases are not limited to a specific TestPlan.
  • testcases (django.db.models.query.QuerySet) – a queryset of TestCases.
Returns:

testcases

Return type:

django.db.models.query.QuerySet

tcms.testcases.views.get_case_status(template_type)[source]

Get part or all TestCaseStatus according to template type

tcms.testcases.views.get_selected_testcases(request)[source]

Get selected TestCases from client side

TestCases are selected in two cases. One is user selects part of displayed TestCases, where there should be at least one variable named case, whose value is the TestCase Id. Another one is user selects all TestCases based on previous filter criterias even through there are non-displayed ones. In this case, another variable selectAll appears in the REQUEST. Whatever its value is.

If neither variables mentioned exists, empty query result is returned.

Parameters:request (django.http.HttpRequest) – django’s HttpRequest
Returns:Queryset with testcases
Return type:django.db.models.query.QuerySet
tcms.testcases.views.get_tags_from_cases(case_ids, plan=None)[source]

Get all tags from test cases

@param case_ids: an iterable object containing test cases’ ids @type case_ids: list, tuple

@param plan: TestPlan object @type plan: tcms.testplans.models.TestPlan

@return: a list containing all found tags with id and name @rtype: list

tcms.testcases.views.get_testcaseplan_sortkey_pk_for_testcases(plan, tc_ids)[source]

Get each TestCase’ sortkey and related TestCasePlan’s pk

tcms.testcases.views.list_all(request)[source]

Generate the TestCase list for the UI tabs in TestPlan page view.

tcms.testcases.views.load_more_cases(request, template_name='plan/cases_rows.html')[source]

Loading more TestCases

tcms.testcases.views.paginate_testcases(request, testcases)[source]

Paginate queried TestCases

Parameters:
  • request (django.http.HttpRequest) – django’s HttpRequest from which to get pagination data
  • testcases (django.db.models.query.QuerySet) – an object queryset representing already queried TestCases
Returns:

the queryset for chain call

Return type:

django.db.models.query.QuerySet

tcms.testcases.views.plan_from_request_or_none(request)[source]

Get TestPlan from REQUEST

This method relies on the existence of from_plan within REQUEST.

tcms.testcases.views.printable(request, template_name='case/printable.html')[source]

Create the printable copy for plan/case. Only CONFIRMED TestCases are printed when printing a TestPlan!

tcms.testcases.views.query_testcases_from_request(request, plan=None)[source]

Query TestCases according to criterias coming within REQUEST

Parameters:
  • request (django.http.HttpRequest) – the REQUEST object.
  • plan (tcms.testplans.models.TestPlan) – instance of TestPlan to restrict only those TestCases belongs to the TestPlan. Can be None. As you know, query from all TestCases.
Returns:

Queryset with testcases and search form

Return type:

django.db.models.query.QuerySet, dict

tcms.testcases.views.sort_queried_testcases(request, testcases)[source]

Sort querid TestCases according to sort key

Parameters:
  • request (django.http.HttpRequest) – django’s HttpRequest
  • testcases (django.db.models.query.QuerySet) – an object queryset representing already queried TestCases
Returns:

Queryset with testcases

Return type:

django.db.models.query.QuerySet