omaciel/robottelo — pull request #975 by Ichimonji10 (2014-07-11 18:48:25+00:00)
Title: Shrink test code, implement Factory.build()

Use the DDT library to collapse numerous test cases into module `tests.foreman.api.test_multiple_paths`. As a result of this change, the following individual modules have been completely removed:

* `tests.foreman.api.test_architecture_v2`
* `tests.foreman.api.test_model_v2`
* `tests.foreman.api.test_operatingsystem_v2`
* `tests.foreman.api.test_organization_v2`

Make module `tests.foreman.api.test_multiple_paths` execute more aggressive tests than the old test modules did. For example, issue HTTP PUT requests to a variety of API URLs, and more consistently assert that the content-type of responses is application/json.

Implement method `Factory.build`. This means that there are now three public methods available on all Factory subclasses:

1. `attributes`
2. `build`
3. `create`

The first just generates attributes for an entity, the second creates all dependent entities and generates attributes for an entity, and the third creates an entity and all of its dependencies.

Rename method `Factory._get_fields` to `Factory._get_values`. This more accurately reflects what the method actually does: generate a dict of `{'field_name': field_value}` pairs. Update tests accordingly.

Improve several error messages. For example, `Factory.create` now tells the URL it was POSTing to if it encounters an error, and so too does one of the assertions in module `tests.foreman.api.test_multiple_paths`.