Permalink
Browse files

Merge branch '1.4.5.2' into dev

  • Loading branch information...
2 parents c89b2cf + b30c697 commit 9a3a9544bb224feb1610d6d5bcba04371b948716 @camd camd committed Apr 2, 2013
View
4 docs/installation.rst
@@ -69,8 +69,8 @@ Python environment.
.. Note::
-On some linux flavors, you may need to run
-``sudo apt-get install libmysqlclient-dev`` prior to bin/install-reqs.
+ On some linux flavors, you may need to run
+ ``sudo apt-get install libmysqlclient-dev`` prior to bin/install-reqs.
Installing the dependencies requires `pip`_ 1.0 or higher. `pip`_ is
automatically available in a `virtualenv`_; if not using `virtualenv`_ you may
View
35 docs/userguide/howto.rst
@@ -19,21 +19,7 @@ on the fields in that screen.
Steps
^^^^^
- #. navigate to ``Manage | Versions``
- #. click the "create a version" button
- #. set the product to the product in question
- #. specify the version to copy Environments and Cases from. In our case,
- this will be ``1.0``
- #. type in the name of the new Version. In our case: ``2.0``
- #. codename is optional.
- #. click the "save productversion" button
-
-Result
-^^^^^^
-Now you will have a new product version, and a new ``2.0`` version of each test
-case. If you change the ``2.0`` version of a case, the ``1.0`` version remains
-unchanged. This is so that the steps in your test can evolve as your product
-does without changing the tests that applied to earlier versions.
+See Tutorial: :ref:`New Version<new-product-version>`
Fill in test cases missing from one Product Version into another
@@ -98,22 +84,7 @@ will need to clone the 1.0 test runs to 2.0 and update them.
Steps
^^^^^
- #. navigate to ``Manage | Runs``
- #. find the test run you want to use in 2.0
- #. click the clone button for that run
- #. The new run will have the name "Cloned: foo" and be in DRAFT mode
- #. edit the newly cloned run. **Note:** It must be in DRAFT mode to change
- the product version field.
- #. Update the name as you wish
- #. change the Product Version field to the new version 2.0:
- * |product_version|
- #. save as status active, or...
- #. activate the new run with the status drop-down.
-
-Result
-^^^^^^
-Now you will have a new run that applies to your new product version ``2.0``
-that is ready to be executed.
+See Tutorial: :ref:`Migrate Runs<migrate-runs>`
Get a link to a result of a test just after submitting it
@@ -140,6 +111,4 @@ that other users have submitted for the same case in that environment.
.. |case_result| image:: img/case_result.png
:height: 40px
-.. |product_version| image:: img/product_version.png
- :height: 40px
View
4 docs/userguide/index.rst
@@ -4,7 +4,7 @@ User's Guide
This guide provides documentation of how to use MozTrap as well as some of
its underlying concepts and design decisions.
-**New to using MozTrap?** See the :ref:`Getting Started Guide <getting-started>`
+**New to using MozTrap?** See the :ref:`Tutorial <tutorial>`
for an overview of some basic tasks to get you rolling.
If you find an issue with MozTrap, please enter a bug in `Bugzilla`_
@@ -14,7 +14,7 @@ If you find an issue with MozTrap, please enter a bug in `Bugzilla`_
.. toctree::
:maxdepth: 3
- gettingstarted
+ tutorial/index
howto
faq
model/products
View
10 docs/userguide/model/execution.rst
@@ -28,8 +28,14 @@ The test case steps executed in test runs may be different for each Product
Version, as the Product itself evolves. See :ref:`Test Cases <test-cases>` for
more info on how test case versions relate to Product Versions.
-An active test run can be disabled, which halts all execution of tests in that
-run until it is made active again.
+.. _test-run-states:
+
+Draft test runs cannot be executed yet. This is a good state if you're still
+working on it and aren't ready for people to see it. It won't show up in the
+list of test runs for your product in the ``Run Tests`` section.
+
+An active test run can be disabled or made draft, which halts all
+execution of tests in that run until it is made active again.
.. _test-run-series:
View
96 docs/userguide/tutorial/create_cases.rst
@@ -0,0 +1,96 @@
+.. _tutorial-create-tests:
+
+MozTrap Tutorial, part 2
+========================
+
+In this section, we discuss creating test cases and organizing them into
+suites.
+
+Create test Suites
+------------------
+
+Test Suites are collections of test cases. A test case can belong to more
+than one suite, if need be.
+
+Let's write some tests to cover two areas of the **SpeckDetector**. It should
+detect specks of sand and specks of pollen. And you should also be able to
+update your SpeckDetector's firmware.
+
+Steps
+^^^^^
+ #. navigate to ``manage | suites``
+ #. click ``create a test suite``
+ #. set your product to ``SpeckDetector``
+ #. set name to ``Specks``
+ #. enter a description that includes Markdown_ syntax::
+
+ PRECONDITIONS
+ =============
+ * Must have some specks
+
+ LINKS
+ =====
+ * [Specks of Life](http://example.com/)
+
+ #. you won't have any available cases yet, so skip that and just
+ click ``save suite``
+ #. repeat these steps for a suite but name it ``Firmware``
+
+Create test Cases
+-----------------
+
+Now we need to create some test cases for those suites.
+
+Steps
+^^^^^
+ #. navigate to ``manage | cases``
+ #. click ``create a test case``
+ #. set your product to ``SpeckDetector``
+ #. set version to ``1.0``
+ #. set suite to ``Specks``
+ #. :ref:`ID Prefix<test-case-edit-fields>` is optional, skip it for now
+ #. set name to ``Detect a pollen speck``
+ #. for ``instruction`` 1, enter::
+
+ hold detector held away from pollen
+
+ #. for ``expected`` 1, enter::
+
+ no detection lights
+
+ #. tab to ``instruction`` 2, enter::
+
+ hold detector above a pollen speck
+
+ #. tab to ``expected`` 2, enter::
+
+ detector lights up word "pollen"
+
+ #. click ``save test case``
+
+
+That's one down. Whew! OK, now create another test case for the ``firmware``
+suite with steps like this:
+
+ #. name: ``update firmware``
+ #. for ``instruction`` 1, enter::
+
+ navigate to firmware update screen and select "update"
+
+ #. for ``expected`` 1, enter::
+
+ see "a firmware update is available"
+
+ #. tab to ``instruction`` 2, enter::
+
+ click "apply update"
+
+ #. tab to ``expected`` 2, enter::
+
+ firmware value should say the new version
+
+
+Great! You're done with your cases!
+
+.. _Markdown: http://daringfireball.net/projects/markdown/syntax
+
View
73 docs/userguide/gettingstarted.rst → docs/userguide/tutorial/create_product.rst
@@ -1,21 +1,14 @@
-.. _getting-started:
+.. _tutorial-create-product:
-Getting Started Guide
-=====================
-
-If you're new to MozTrap and would like a general walk-though of how to get
-initial data setup and start testing your product, this is your guide.
-
-
-Setup a new product in a new system
------------------------------------
+MozTrap Tutorial, part 1
+========================
The following is a description of how to setup your new system to test your
-product.
+product. Part 1 will focus on setting up your Product and Environments.
-Create environments
-^^^^^^^^^^^^^^^^^^^
+Setup Environments
+------------------
Odds are you will be testing your product in several
:ref:`environments<environments>`. These could be a collection of hardware
@@ -35,20 +28,31 @@ steps:
#. navigate to ``manage | environments``
* |manage_environments|
#. click ``create a profile``
- #. give your profile a name
- #. Depending on your setup, you may have several
- :ref:`environment elements<environment-elements>` in your system already.
- #. If you see a category that applies to your product already, then expand
- It to choose the elements that apply. If not, then click |add_category|
- to create a new one
- #. Within a category, if you don't see the correct element, then create
- one by typing in the field |add_element| and hitting enter
- #. Once you have all the categories and elements checked that you want to
- test, click ``save profile``
-
-This will create a matrix list of all possible combinations of the environment
-elements you chose. However, it may be true that you don't want to test ALL
-combinations. If that's the case, then you can winnow down the list to test.
+ #. give your profile the name ``Speck Envs``
+ #. .. note::
+
+ Depending on your setup, you may have several
+ :ref:`environment elements<environment-elements>` in your system already.
+
+ If you see a category that applies to your product already, then expand
+ It to choose the elements that apply. If not, then click |add_category|
+ to create a new one
+ #. In our case, we'll need to create everything, so click |add_category|
+ and type ``location`` and hit enter
+ #. in the category, find the field that says |add_element| and type
+ ``laboratory`` and hit "enter"
+ #. add another element called ``field`` and hit enter
+ #. make sure to check the ``location`` category and all its elements
+ #. click ``save profile``
+
+.. note::
+
+ This will create a matrix list of all possible combinations of the
+ environment elements for each category you chose. In our case it's very
+ simple (only 2). However, for other products, you may have several
+ categories. It may be true that you don't want to test ALL combinations
+ that were created. If that's the case, then you can winnow down the list
+ to test.
To winnow down the list of environments to test:
@@ -58,9 +62,10 @@ To winnow down the list of environments to test:
Create a Product
-^^^^^^^^^^^^^^^^
+----------------
-For this example, we will presume your product is called **SpeckDetector**.
+Now that you have your environment profile setup, let's create your product.
+We will presume your product is called **SpeckDetector**.
It detects specks. Very handy.
#. navigate to ``manage | products``:
@@ -85,13 +90,3 @@ It detects specks. Very handy.
.. |edit_icon| image:: img/edit_icon.png
:height: 20px
-
-Create some tests in an existing system
----------------------------------------
-
-In progress...
-
-Run some tests in an existing system
-------------------------------------
-
-In progress...
View
72 docs/userguide/tutorial/create_runs.rst
@@ -0,0 +1,72 @@
+.. _tutorial-create-runs:
+
+Moztrap Tutorial, part 3
+========================
+
+In this section, we use the pieces you've already built to create and activate
+a test run that users can execute.
+
+
+Create a Test Run
+-----------------
+
+Test Runs are made up of test suites and are specific to a version of your
+product. You may want to have several test runs. One could be called
+``smoke`` and another ``feature complete`` and yet another
+``full functional tests``. Or you could break them up into larger functional
+areas like ``front-end`` and ``server``.
+
+Let's create your first **SpeckDetector** test run. It will contain all the
+suites you have created so far. Let's call this ``feature complete``.
+
+Steps
+^^^^^
+ #. navigate to ``manage | runs``
+ #. click ``create a test run``
+ #. set your product version to ``SpeckDetector 1.0``
+ #. set name to ``feature complete``
+ #. enter a description that includes Markdown_ syntax. This information
+ will be displayed at the top of each page while running the tests::
+
+ LINKS
+ =====
+ * [Specks of Life](http://example.com/)
+ * [Bugzilla](http://bugzilla.mycompany.com)
+
+ #. :ref:`series<test-run-series>` defaults to true. We will want to run
+ our tests against several ongoing builds of the **SpeckDetector**, so
+ in our case we *will* create a series. Please take a moment to see
+ what a :ref:`run series<test-run-series>` is.
+ #. Leave the ``start`` date as today. If you want the run to expire, then
+ set the ``end`` date, too.
+ #. drag both suites from ``available`` to ``included``
+ #. click ``save run``
+
+
+Activate your Run
+-----------------
+
+Your run is just about ready. However, there's one more critical step you
+must take before it can be executed. You must make the run *active*.
+
+Why not have test runs active all the time? Good question.
+:ref:`Look here<test-run-states>`, Curious George.
+
+Steps
+^^^^^
+ #. navigate to ``manage | runs``
+ #. find your test run ``feature complete``
+ #. click the status icon
+ * |run_activate|
+ #. click "Activate"
+
+.. |run_activate| image:: img/run_activate.png
+ :height: 150px
+
+
+Isn't this exciting? You now have a test run series created and ready to go!
+Go tell your boss.
+
+
+.. _Markdown: http://daringfireball.net/projects/markdown/syntax
+
View
0 docs/userguide/img/add_category.png → docs/userguide/tutorial/img/add_category.png
File renamed without changes
View
0 docs/userguide/img/add_element.png → docs/userguide/tutorial/img/add_element.png
File renamed without changes
View
0 docs/userguide/img/edit_icon.png → docs/userguide/tutorial/img/edit_icon.png
File renamed without changes
View
0 docs/userguide/img/manage_environments.png → ...uide/tutorial/img/manage_environments.png
File renamed without changes
View
0 docs/userguide/img/manage_products.png → ...serguide/tutorial/img/manage_products.png
File renamed without changes
View
0 docs/userguide/img/product_version.png → ...serguide/tutorial/img/product_version.png
File renamed without changes
View
BIN docs/userguide/tutorial/img/run_activate.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
33 docs/userguide/tutorial/index.rst
@@ -0,0 +1,33 @@
+.. image:: ../../img/126x126.png
+
+.. _tutorial:
+
+MozTrap Tutorial
+================
+
+This tutorial assumes that your instance of MozTrap has been fully installed
+and that you are a user with the role of :ref:`Admin<admin-role>`.
+
+.. note::
+ This tutorial is a work in progress and is, as yet, incomplete.
+
+Contents
+--------
+
+.. toctree::
+ :maxdepth: 2
+
+ create_product
+ create_cases
+ create_runs
+ start_testing
+ view_results
+ new_version
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
View
63 docs/userguide/tutorial/new_version.rst
@@ -0,0 +1,63 @@
+.. _tutorial-new-version:
+
+Moztrap Tutorial, part 6
+========================
+
+.. _new-product-version:
+
+Create New Version
+------------------
+
+Now let's say that you shipped version 1.0 and are ready to start testing
+version 2.0 of the **SpeckDetector**.
+
+Steps
+^^^^^
+
+ #. navigate to ``Manage | Versions``
+ #. click the "create a version" button
+ #. set the product to the ``SpeckDetector``
+ #. specify the version to copy Environments and Cases from. In our case,
+ this will be ``1.0``
+ #. type in the name of the new Version. In our case: ``2.0``
+ #. codename is optional.
+ #. click the "save productversion" button
+
+
+Result
+^^^^^^
+Now you will have a new product version, and a new ``2.0`` version of each test
+case. If you change the ``2.0`` version of a case, the ``1.0`` version remains
+unchanged. This is so that the steps in your test can evolve as your product
+does without changing the tests that applied to earlier versions.
+
+
+.. _migrate_runs:
+
+Migrate Runs
+------------
+
+Test runs are specific to a version of your product. But you can easily
+make copies of runs from one to the other.
+
+Steps
+^^^^^
+ #. navigate to ``Manage | Runs``
+ #. find the test run you want to use in 2.0
+ #. click the clone button for that run
+ #. The new run will have the name "Cloned: foo" and be in DRAFT mode
+ #. edit the newly cloned run. **Note:** It must be in DRAFT mode to change
+ the product version field.
+ #. Update the name as you wish
+ #. change the Product Version field to the new version 2.0:
+ * |product_version|
+ #. save as status active, or...
+ #. activate the new run with the status drop-down.
+
+Result
+^^^^^^
+Now you will have a new run that applies to your new product version ``2.0``
+that is ready to be executed.
+
+.. |product_version| image:: img/product_version.png
+ :height: 40px
View
67 docs/userguide/tutorial/start_testing.rst
@@ -0,0 +1,67 @@
+.. _tutorial-start-testing:
+
+Moztrap Tutorial, part 4
+========================
+
+You have now built all the parts you need to start testing your product.
+Allons-y! (Let's go!)
+
+Start Testing
+-------------
+
+There are a few ways to get to your test run to execute it.
+
+Run Tests Steps
+^^^^^^^^^^^^^^^
+ #. navigate to ``run tests``
+ #. in the finder, click ``SpeckDetector``
+ #. click ``1.0``
+ #. click ``feature complete``
+ #. This is a :ref:`run series<test-run-series>` so you will be asked to enter
+ a ``build``. Let's pretend this is your 5th feature complete build.
+ Here type: ``FC-5``
+ #. set ``location`` to ``field``
+ #. click ``run tests in feature complete``
+
+
+Manage Runs Steps
+^^^^^^^^^^^^^^^^^
+ #. navigate to ``manage | runs``
+ #. find the ``feature complete`` run
+ #. expand the arrow on the left to display the details of that run
+ #. click the green button that says ``run tests in feature complete``
+ #. .. note::
+ if you want to send this URL to your testers in an email, then just
+ right-click that same button and select ``copy link location``.
+ #. specify your environment, as above.
+
+"I got a URL!" Steps
+^^^^^^^^^^^^^^^^^^^^
+ #. If somebody gave you a URL to their run or run series, then click on it.
+ #. specify your environment, as above.
+
+Pass a Test
+-----------
+Some tests pass, some fail. This is the way of the world. Let's pass this
+one.
+
+ #. Click the title or expansion arrow of ``update firmware``
+ #. Click ``pass test``
+ #. that was easy
+
+Fail a Test
+-----------
+
+ #. Click the title or expansion arrow of ``Detect a pollen speck``
+ #. Click ``fail test`` next to the first step.
+ #. you must provide some explanation for the failure::
+
+ We applied the cortical electrodes but were unable to get
+ a neural reaction from the pollen speck.
+
+ #. speficying a bug URL is optional, but it's a good idea. I'll leave
+ that up to you.
+
+
+You're done with the run! This is fantastic! If only those kids from High
+School could see you *now!*
View
9 docs/userguide/tutorial/view_results.rst
@@ -0,0 +1,9 @@
+.. _tutorial-view-results:
+
+Moztrap Tutorial, part 5
+========================
+
+View Results
+------------
+
+Coming soon!
View
12 jstemplates/case_select_item.html
@@ -1,14 +1,16 @@
{{#items}}
<article class="selectitem" data-title="{{ name }}" data-product-id="{{ product_id }}">
- <input type="checkbox" name="bulk-select" value="{{ case_id }}" class="bulk-value" id="bulk-select-{{ case_id }}" {{ checked }}>
+ <input type="checkbox" name="bulk-select" value="{{ id }}" class="bulk-value" id="bulk-select-{{ id }}" {{ checked }}>
<div class="listitem itemhead bulk-item">
- <label for="bulk-select-{{ case_id }}" class="bulk-type" title="select or drag">bulk select {{ case_id }}</label>
+ <label for="bulk-select-{{ id }}" class="bulk-type" title="select or drag">bulk select {{ case_id }}</label>
<div class="name-tags">
<h5 class="title" title="{{ name }}">{{ name }}</h5>
<ul class="tags">
- {{#tags}}
- <li><a href="#{{ name|slugify }}" title="filter by {{ name }}" class="filter-link tag" data-type="tag">{{ name }}</a></li>
- {{/tags}}
+ {{#versions}}
+ {{#tags}}
+ <li><a href="#{{ name|slugify }}" title="filter by {{ name }}" class="filter-link tag" data-type="tag">{{ name }}</a></li>
+ {{/tags}}
+ {{/versions}}
</ul>
</div>
View
19 moztrap/model/execution/api.py
@@ -1,3 +1,4 @@
+from django.db.models import Max
from tastypie.resources import ModelResource, ALL_WITH_RELATIONS
from tastypie import fields
from tastypie.bundle import Bundle
@@ -300,14 +301,14 @@ class SuiteSelectionResource(BaseSelectionResource):
product = fields.ForeignKey(ProductResource, "product")
runs = fields.ToManyField(RunResource, "runs")
- created_by = fields.ForeignKey(UserResource, "created_by", full=True, null=True)
+ created_by = fields.ForeignKey(
+ UserResource, "created_by", full=True, null=True)
class Meta:
queryset = Suite.objects.all().select_related(
"created_by",
- ).prefetch_related(
- "runsuites",
- ).distinct().order_by("runsuites__order")
+ ).annotate(order=Max("runsuites__order")).order_by("order")
+
list_allowed_methods = ['get']
fields = ["id", "name", "created_by"]
filtering = {
@@ -324,14 +325,6 @@ def dehydrate(self, bundle):
bundle.data["suite_id"] = unicode(suite.id)
bundle.data["case_count"] = suite.cases.count()
bundle.data["filter_cases"] = filter_url("manage_cases", suite)
-
- if "runs" in bundle.request.GET.keys():
- run_id = int(bundle.request.GET["runs"])
- s = suite.runsuites.all()
- order = [x.order for x in suite.runsuites.all()
- if x.run_id == run_id][0]
- bundle.data["order"] = order
- else:
- bundle.data["order"] = None
+ bundle.data["order"] = suite.order
return bundle
View
58 moztrap/model/library/api.py
@@ -1,3 +1,4 @@
+from django.db.models import Max
from tastypie import http, fields
from tastypie.exceptions import ImmediateHttpResponse
from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS
@@ -210,6 +211,7 @@ class Meta(MTResource.Meta):
"productversion": ALL_WITH_RELATIONS,
"case": ALL_WITH_RELATIONS,
"tags": ALL_WITH_RELATIONS,
+ "latest": ALL,
}
authorization = CaseVersionAuthorization()
@@ -316,47 +318,43 @@ class CaseSelectionResource(BaseSelectionResource):
for selecting cases.
"""
- case = fields.ForeignKey(CaseResource, "case")
- productversion = fields.ForeignKey(
- ProductVersionResource, "productversion")
- tags = fields.ToManyField(TagResource, "tags", full=True)
- created_by = fields.ForeignKey(UserResource, "created_by", full=True, null=True)
+ product = fields.ForeignKey(ProductResource, "product")
+ versions = fields.ToManyField(
+ 'moztrap.model.library.api.CaseVersionSelectionResource',
+ # filter for only the latest of the caseversions
+ lambda bundle: CaseVersion.objects.filter(
+ case=bundle.obj,
+ latest=True
+ ),
+ related_name="versions",
+ full=True,
+ )
+ suites = fields.ToManyField(SuiteResource, "suites")
class Meta:
- queryset = CaseVersion.objects.all().select_related(
- "case",
- "productversion",
- "created_by",
+ queryset = Case.objects.all().select_related(
+ "product",
).prefetch_related(
- "tags",
- "case__suitecases",
- ).distinct().order_by("case__suitecases__order")
+ "versions__tags",
+ ).annotate(
+ order=Max("suitecases__order"),
+ ).order_by("order")
+
list_allowed_methods = ['get']
- fields = ["id", "name", "latest", "created_by"]
+ fields = ["id", "versions", "created_by"]
filtering = {
- "productversion": ALL_WITH_RELATIONS,
- "tags": ALL_WITH_RELATIONS,
- "case": ALL_WITH_RELATIONS,
- "latest": ALL,
- "created_by": ALL_WITH_RELATIONS
+ "product": ALL_WITH_RELATIONS,
+ "versions": ALL_WITH_RELATIONS,
+ "created_by": ALL_WITH_RELATIONS,
+ "suites": ALL_WITH_RELATIONS
}
def dehydrate(self, bundle):
"""Add some convenience fields to the return JSON."""
- case = bundle.obj.case
- bundle.data["case_id"] = unicode(case.id)
- bundle.data["product_id"] = unicode(case.product_id)
- bundle.data["product"] = {"id": unicode(case.product_id)}
-
- if "case__suites" in bundle.request.GET.keys():
- suite_id = int(bundle.request.GET["case__suites"])
- order = [x.order for x in case.suitecases.all()
- if x.suite_id == suite_id][0]
- bundle.data["order"] = order
- else:
- bundle.data["order"] = None
+ bundle.data["name"] = unicode(bundle.obj.versions.all()[0].name)
+ bundle.data["order"] = bundle.obj.order
return bundle
View
7 static/js/init.js
@@ -184,11 +184,10 @@ var MT = (function (MT, $) {
container: '#suite-edit-form, #suite-add-form',
trigger_field: '#id_product',
ajax_url_root: "/api/v1/caseselection/?format=json&limit=0",
- ajax_trigger_filter: "productversion__product",
- ajax_for_field: "case__suites",
+ ajax_trigger_filter: "product",
+ ajax_for_field: "suites",
for_type: "suite",
- ich_template: ich.case_select_item,
- use_latest: true
+ ich_template: ich.case_select_item
});
MT.populateMultiselectItems({
container: '#tag-add-form, #tag-edit-form',
View
78 tests/model/library/api/test_case_resource.py
@@ -112,34 +112,54 @@ def resource_name(self):
@property
def included_param(self):
- return "case__suites"
+ return "suites"
@property
def available_param(self):
return "{0}__ne".format(self.included_param)
- def get_exp_obj(self, cv, order=None):
+ def get_exp_obj(self, cv, order=None, suites=None):
"""Return an expected caseselection object with fields filled."""
+ if not suites:
+ suites = []
+ case = cv.case
+ product = case.product
+ pv = cv.productversion
+
return {
- u"case": unicode(
- self.get_detail_url("case", cv.case.id)),
- u"case_id": unicode(cv.case.id),
- u"created_by": None,
- u"id": unicode(cv.id),
- u"latest": True,
+ u'suites': [unicode(self.get_detail_url("suite", s.id)) for s in suites],
+ u"product": unicode(self.get_detail_url("product", product.id)),
u"name": unicode(cv.name),
+ u'versions': [{
+ u"case": unicode(
+ self.get_detail_url("case", case.id)),
+ u'product': {u'id': unicode(product.id)},
+ u"name": unicode(cv.name),
+ u'tags': [],
+ u'productversion_name': unicode(pv.name),
+ u'created_by': None,
+ u'case_id': unicode(cv.case.id),
+ u'productversion': {
+ u'product': unicode(self.get_detail_url(
+ "product", product.id)),
+ u'codename': u'',
+ u'version': unicode(pv.version),
+ u'id': unicode(pv.id),
+ u'resource_uri': unicode(self.get_detail_url(
+ "productversion", pv.id))
+ },
+ u'resource_uri': unicode(
+ self.get_detail_url("caseversionselection", cv.id)),
+ u'product_id': unicode(product.id),
+ u'id': unicode(cv.id),
+ u'latest': True
+ }],
+ u'id': unicode(case.id),
u"order": order,
- u"product": {
- u"id": unicode(cv.productversion.product_id)
- },
- u"product_id": unicode(cv.productversion.product_id),
- u"productversion": unicode(
- self.get_detail_url("productversion", cv.productversion.id)),
u"resource_uri": unicode(
- self.get_detail_url("caseselection", cv.id)),
- u"tags": [],
+ self.get_detail_url("caseselection", case.id)),
}
@@ -163,7 +183,7 @@ def _do_test(self, for_id, filter_param, exp_objects):
act = res.json
self.maxDiff = None
- self.assertEquals(act["meta"], self.get_exp_meta(len(exp_objects)))
+ self.assertEquals(self.get_exp_meta(len(exp_objects)), act["meta"])
self.assertEqual(exp_objects, act["objects"])
@@ -214,10 +234,16 @@ def test_included_for_two_included(self):
data = self._setup_two_included()
- exp_objects = [self.get_exp_obj(cv, order=sc.order) for cv, sc in [
- (data["cv1"], data["sc1"]),
- (data["cv2"], data["sc2"]),
- ]]
+ exp_objects = [
+ self.get_exp_obj(
+ cv,
+ order=sc.order,
+ suites=[data["s"]],
+ ) for cv, sc in [
+ (data["cv1"], data["sc1"]),
+ (data["cv2"], data["sc2"]),
+ ]
+ ]
self._do_test(
data["s"].id,
@@ -260,9 +286,13 @@ def test_included_for_one_included_one_not(self):
"""Get a list of included cases, one included"""
data = self._setup_for_one_included_one_not()
- exp_objects = [self.get_exp_obj(cv, order=sc.order) for cv, sc in [
- (data["cv1"], data["sc1"]),
- ]]
+ exp_objects = [
+ self.get_exp_obj(
+ cv,
+ order=sc.order,
+ suites=[data["s"]],
+ ) for cv, sc in [(data["cv1"], data["sc1"])]
+ ]
self._do_test(
data["s"].id,
View
30 tests/model/library/api/test_suite_resource.py
@@ -273,3 +273,33 @@ def test_included_for_one_included_one_not(self):
self.included_param,
exp_objects=exp_objects,
)
+
+
+ def test_available_included_in_other_runs(self):
+ """Get a list of available suites, when suites included elsewhere"""
+
+ s1 = self.factory.create(name="Suite1")
+ s2 = self.factory.create(name="Suite2")
+ run1 = self.F.RunFactory.create()
+ runsuite1 = self.F.RunSuiteFactory.create(
+ run=run1, suite=s1, order=0)
+ runsuite2 = self.F.RunSuiteFactory.create(
+ run=run1, suite=s2, order=1)
+ run2 = self.F.RunFactory.create()
+ runsuite3 = self.F.RunSuiteFactory.create(
+ run=run2, suite=s1, order=0)
+ runsuite4 = self.F.RunSuiteFactory.create(
+ run=run2, suite=s2, order=1)
+
+ self._do_test(
+ -1,
+ self.available_param,
+ [self.get_exp_obj(
+ s,
+ runs=[
+ unicode(self.get_detail_url("run", run1.id)),
+ unicode(self.get_detail_url("run", run2.id)),
+ ],
+ order=rs.order
+ ) for s, rs in [(s1, runsuite3), (s2, runsuite4)]],
+ )

0 comments on commit 9a3a954

Please sign in to comment.