runway.cfngin.blueprints.testutil module¶
Provides a subclass of unittest.TestCase for testing blueprints.
- class runway.cfngin.blueprints.testutil.BlueprintTestCase[source]¶
Bases:
TestCase
Extends the functionality of unittest.TestCase for testing blueprints.
- class runway.cfngin.blueprints.testutil.YamlDirTestGenerator[source]¶
Bases:
object
Generate blueprint tests from yaml config files.
This class creates blueprint tests from yaml files with a syntax similar to CFNgin configuration syntax. For example:
namespace: test stacks: - name: test_sample class_path: blueprints.test.Sample variables: var1: value1
Will create a test for the specified blueprint, passing that variable as part of the test.
The test will generate a
.json
file for this blueprint, and compare it with the stored result.By default, the generator looks for files named
test_*.yaml
in its same directory. In order to use it, subclass it in a directory containing such tests, and name the class with a pattern that will include it in nosetests’ tests (for example, TestGenerator).The subclass may override some
@property
definitions:- base_class
By default, the generated tests are subclasses or
runway.cfngin.blueprints.testutil.BlueprintTestCase
. In order to change this, set this property to the desired base class.- yaml_dirs:
By default, the directory where the generator is subclassed is searched for test files. Override this array for specifying more directories. These must be relative to the directory in which the subclass lives in. Globs may be used. Default:
['.']
. Example override:['.', 'tests/*/']
- yaml_filename:
By default, the generator looks for files named
test_*.yaml
. Use this to change this pattern. Globs may be used.
- property base_class: type[BlueprintTestCase]¶
Return the baseclass.
- test_generator() Iterator[BlueprintTestCase] [source]¶
Test generator.