intercom_test.cases module

class intercom_test.cases.IdentificationListReader(key_fields, *, safe_loading=None)[source]

Bases: object

Utility class to read case ID and associated events from a YAML event stream

This class is used internally to identify test cases when correlating the test case with existing augmentation data for editing. In that case, both the Python-native representation of the test case (for hash_from_fields()) and the YAML event stream for the key/value pairs (to preserve as much format from the source file) are needed.

class State[source]

Bases: enum.Enum

An enumeration.

content = 2
header = 1
tail = 3
read(event)[source]
safe_loading = True
intercom_test.cases.hash_from_fields(test_case)[source]

Compute a string hash from any acyclic, JSON-ic dict

Parameters:test_case (dict) – test case data to be hashed
Returns:a repeatably generatable hash of test_case
Return type:str

The hash is computed by encoding test_case in ASN1 DER (see json_asn1.types.ASN1_SOURCE for the ASN1 syntax of the data format), then hashing with SHA-256, and finally Base64 encoding to get the result.

Note that this function hashes all key/value pairs of test_case.