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:
Public Member Functions | |
| process (self, engine) | |
| data_request (self, requests) | |
| test_resource_key_alone_is_accepted (self) | |
| test_resource_key_with_licence_key_is_accepted (self) | |
| test_licence_key_with_properties_is_accepted (self) | |
| test_licence_key_discovers_properties_with_the_key_in_the_body (self) | |
| test_licence_key_without_properties_is_refused (self) | |
| test_properties_with_resource_key_are_refused (self) | |
| test_no_credential_is_refused (self) | |
| test_whitespace_counts_as_absent (self) | |
| test_properties_may_be_one_comma_separated_string (self) | |
| test_reserved_evidence_is_left_out_of_the_body (self) | |
| test_properties_added_later_are_normalised_and_checked (self) | |
| test_properties_the_answer_leaves_out_are_reported_once (self) | |
| test_no_report_when_every_property_came_back (self) | |
| test_missing_property_message_names_both_causes (self) | |
Member Function Documentation
◆ 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.
◆ 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_checked()
| tests.test_credentials.TestCredentials.test_properties_added_later_are_normalised_and_checked | ( | 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 the rule that a list only goes with a licence key alone is checked again, because the constructor cannot see a list added after it ran.
◆ 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_refused()
| tests.test_credentials.TestCredentials.test_properties_with_resource_key_are_refused | ( | self | ) |
Row five of the table, with and without a licence key beside the resource key. The service ignores the list, so the engine refuses to build and says the response would not narrow.
◆ 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. The licence key adds the products it grants, so it 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.
