deckhand.factories module¶
-
class
deckhand.factories.
DataSchemaFactory
[source]¶ Bases:
deckhand.factories.DeckhandFactory
Class for auto-generating
DataSchema
templates for testing.-
DATA_SCHEMA_TEMPLATE
= {'data': {'$schema': ''}, 'metadata': {'labels': {}, 'layeringDefinition': {'abstract': True, 'layer': 'site'}, 'name': '', 'schema': 'metadata/Control/v1'}, 'schema': 'deckhand/DataSchema/v1'}¶
-
-
class
deckhand.factories.
DocumentFactory
(num_layers, docs_per_layer)[source]¶ Bases:
deckhand.factories.DeckhandFactory
Class for auto-generating document templates for testing.
-
DOCUMENT_TEMPLATE
= {'data': {}, 'metadata': {'labels': {'': ''}, 'layeringDefinition': {'abstract': False, 'layer': 'layer'}, 'name': '', 'schema': 'metadata/Document/v1', 'storagePolicy': 'cleartext'}, 'schema': 'example/Kind/v1'}¶
-
LAYERING_POLICY_TEMPLATE
= {'data': {'layerOrder': []}, 'metadata': {'layeringDefinition': {'abstract': False, 'layer': 'layer'}, 'name': 'placeholder', 'schema': 'metadata/Control/v1'}, 'schema': 'deckhand/LayeringPolicy/v1'}¶
-
gen_test
(mapping, site_abstract=True, region_abstract=True, global_abstract=True, site_parent_selectors=None)[source]¶ Generate the document template.
Generate the document template based on the arguments passed to the constructor and to this function.
Parameters: - mapping (dict) –
A list of dictionaries that specify the “data” and “actions” parameters for each document. A valid mapping is:
mapping = { "_GLOBAL_DATA_1_": {"data": {"a": {"x": 1, "y": 2}}}, "_SITE_DATA_1_": {"data": {"a": {"x": 7, "z": 3}, "b": 4}}, "_SITE_ACTIONS_1_": { "actions": [{"method": "merge", "path": path}]} }
Each key must be of the form “_{LAYER_NAME}_{KEY_NAME}_{N}_” where:
- {LAYER_NAME} is the name of the layer (“global”, “region”,
- ”site”)
- {KEY_NAME} is either “DATA” or “ACTIONS”
- {N} is the occurrence of the document based on the
- values in
docs_per_layer
. Ifdocs_per_layer
is (1, 2) then _GLOBAL_DATA_1_, _SITE_DATA_1_, _SITE_DATA_2_, _SITE_ACTIONS_1_ and _SITE_ACTIONS_2_ must be provided. _GLOBAL_ACTIONS_{N}_ is ignored.
- site_abstract (boolean) – Whether site layers are abstract/concrete.
- region_abstract (boolean) – Whether region layers are abstract/concrete.
- global_abstract (boolean) – Whether global layers are abstract/concrete.
- site_parent_selectors (list) –
Override the default parent selector for each site. Assuming that
docs_per_layer
is (2, 2), for example, a valid value is:[{'global': 'global1'}, {'global': 'global2'}]
If not specified, each site will default to the first parent.
Returns: Rendered template of the form specified above.
- mapping (dict) –
-
-
class
deckhand.factories.
DocumentSecretFactory
[source]¶ Bases:
deckhand.factories.DeckhandFactory
Class for auto-generating document secrets templates for testing.
Returns formats that adhere to the following supported schemas:
- deckhand/Certificate/v1
- deckhand/CertificateKey/v1
- deckhand/Passphrase/v1
-
DOCUMENT_SECRET_TEMPLATE
= {'data': {}, 'metadata': {'layeringDefinition': {'abstract': False, 'layer': 'site'}, 'name': '', 'schema': 'metadata/Document/v1', 'storagePolicy': ''}, 'schema': 'deckhand/%s/v1'}¶
-
class
deckhand.factories.
RenderedDocumentFactory
(bucket, revision)[source]¶ Bases:
deckhand.factories.DeckhandFactory
Class for auto-generating Rendered document for testing.
-
RENDERED_DOCUMENT_TEMPLATE
= {'data': {}, 'data_hash': '', 'metadata': {'layeringDefinition': {'abstract': False, 'layer': 'site'}, 'name': '', 'schema': 'metadata/Document/v1', 'storagePolicy': ''}, 'metadata_hash': '', 'name': '', 'schema': 'deckhand/%s/v1', 'status': {'bucket': '', 'revision': ''}}¶
-