Detailed Description
Checks every combination of resource key, licence key and requested properties in the Credentials table of the cloud request engine specification, and where each credential travels in the requests the engine makes.
Inheritance diagram for tests.test_credentials.TestCredentials:
Collaboration diagram for tests.test_credentials.TestCredentials:
Member Function Documentation
◆ assert_other_evidence_sent()
| tests.test_credentials.TestCredentials.assert_other_evidence_sent | ( | self, | |
| content ) |
◆ data_request()
| tests.test_credentials.TestCredentials.data_request | ( | self, | |
| requests ) |
The last request, being the one for data.
◆ process()
| tests.test_credentials.TestCredentials.process | ( | self, | |
| engine ) |
Run one flow data through a pipeline holding the engine, and give back the requests the mock client saw.
◆ send_with_reserved_evidence()
| tests.test_credentials.TestCredentials.send_with_reserved_evidence | ( | self, | |
| settings ) |
Process one flow data holding evidence named resource, license, licence and values in mixed case under each prefix, with other evidence beside it, and give back the body of the data request.
◆ test_a_name_left_out_beside_a_resource_key_alone_is_not_a_property()
| tests.test_credentials.TestCredentials.test_a_name_left_out_beside_a_resource_key_alone_is_not_a_property | ( | self | ) |
With a resource key, a list and no licence key, a property no licence grants comes back as null with its nullreason, so a name the answer leaves out is not a property at all. The engine says so, once, and does not name a licence key that was never given.
◆ test_an_answer_that_is_not_an_object_does_not_fail_the_request()
| tests.test_credentials.TestCredentials.test_an_answer_that_is_not_an_object_does_not_fail_the_request | ( | self | ) |
The report compares the answer with the list, and an answer that parses as JSON but is not an object has nothing to compare. It must not fail the request, because the request itself succeeded, so the engine leaves the answer alone and says nothing.
◆ test_evidence_never_supplies_resource_or_license()
| tests.test_credentials.TestCredentials.test_evidence_never_supplies_resource_or_license | ( | self | ) |
With a Resource Key and a License Key configured, the body carries those two and none of the evidence named resource, license or values, in any case and under any prefix.
◆ test_evidence_never_supplies_values()
| tests.test_credentials.TestCredentials.test_evidence_never_supplies_values | ( | self | ) |
With a License Key and Requested Properties configured, the body carries the configured list as values and the License Key as license, and no resource, whatever the evidence holds.
◆ test_evidence_no_element_accepts_is_sent()
| tests.test_credentials.TestCredentials.test_evidence_no_element_accepts_is_sent | ( | self | ) |
The engine sends every evidence value in the flow data apart from the reserved names, so a header and a cookie that no element in a default pipeline accepts are sent as well.
◆ test_licence_key_discovers_properties_with_the_key_in_the_body()
| tests.test_credentials.TestCredentials.test_licence_key_discovers_properties_with_the_key_in_the_body | ( | self | ) |
The accessible properties request made with a licence key alone posts the key in the body, and the engine builds with the metadata the service answers.
◆ test_licence_key_with_properties_is_accepted()
| tests.test_credentials.TestCredentials.test_licence_key_with_properties_is_accepted | ( | self | ) |
Row three of the table. With no resource key the data request goes to the route that takes none, and the body names the licence key and the properties wanted. The licence key never appears in a URL.
◆ test_licence_key_without_properties_is_refused()
| tests.test_credentials.TestCredentials.test_licence_key_without_properties_is_refused | ( | self | ) |
Row four of the table. The service answers 400 to every such request, so the engine refuses to build and says why.
◆ test_missing_property_message_names_both_causes()
| tests.test_credentials.TestCredentials.test_missing_property_message_names_both_causes | ( | self | ) |
With a licence key the accessible properties list everything the licence entitles, so a property can be listed as carried and still be absent from an answer because it was not requested. The message for a property that is not in the data says so, and names the element it looked in rather than assuming device.
◆ test_no_credential_is_refused()
| tests.test_credentials.TestCredentials.test_no_credential_is_refused | ( | self | ) |
Row six of the table, with and without a list of properties. There is nothing to authenticate with.
◆ test_no_report_when_every_property_came_back()
| tests.test_credentials.TestCredentials.test_no_report_when_every_property_came_back | ( | self | ) |
An answer carrying every requested property raises no warning, and an engine on a resource key sends no list so there is nothing to compare.
◆ test_properties_added_later_are_normalised_and_sent()
| tests.test_credentials.TestCredentials.test_properties_added_later_are_normalised_and_sent | ( | self | ) |
A caller may add to the list after the engine is built, once the accessible properties say which client-side properties the key carries. The names added are trimmed and lower-cased as the constructor's are, so they match the answer, and they are sent beside a resource key as well as beside a licence key alone.
◆ test_properties_may_be_one_comma_separated_string()
| tests.test_credentials.TestCredentials.test_properties_may_be_one_comma_separated_string | ( | self | ) |
A configuration file holds the list as one string, so that form is accepted and each name is trimmed and lower-cased to match the case the service answers in.
◆ test_properties_the_answer_leaves_out_are_reported_once()
| tests.test_credentials.TestCredentials.test_properties_the_answer_leaves_out_are_reported_once | ( | self | ) |
The service drops a property the licence key does not cover without naming it. The engine compares the list it sent with the answer, warns once naming the missing property, and does not warn again on the next request. A property present but null counts as answered, because its nullreason explains it.
◆ test_properties_with_resource_key_are_sent()
| tests.test_credentials.TestCredentials.test_properties_with_resource_key_are_sent | ( | self | ) |
A list beside a resource key, with and without a licence key. The service adds the listed properties to those the resource key carries, so the engine builds and sends the list as values, with the licence key in the body where there is one.
◆ test_reserved_evidence_is_left_out_of_the_body()
| tests.test_credentials.TestCredentials.test_reserved_evidence_is_left_out_of_the_body | ( | self | ) |
The service advertises values, resource and license among its accepted evidence keys. Evidence carrying one of them would sit in the body beside the engine's own credentials, so it is dropped whatever its prefix.
◆ test_resource_key_alone_is_accepted()
| tests.test_credentials.TestCredentials.test_resource_key_alone_is_accepted | ( | self | ) |
Row one of the table. The resource key names the route and the body carries the resource key and the evidence, with no licence key and no list of properties.
◆ test_resource_key_with_licence_key_is_accepted()
| tests.test_credentials.TestCredentials.test_resource_key_with_licence_key_is_accepted | ( | self | ) |
Row two of the table. With no list the answer holds what the resource key carries and the licence key adds no property, so the licence key travels in the body of the data request and of the accessible properties request, and no list of properties is sent.
◆ test_whitespace_counts_as_absent()
| tests.test_credentials.TestCredentials.test_whitespace_counts_as_absent | ( | self | ) |
A credential read from the environment often carries a trailing newline, and a value that is only whitespace is a mistake rather than a key. Each is trimmed, and an empty one is treated as absent in the rules, so whitespace alone cannot satisfy them.
