51Degrees Pipeline for Python

tests.live_cloud Namespace Reference

Detailed Description

Where the tests that call the live 51Degrees cloud service find their
resource key, and what they fail with when there is none or when the
answer lacks what they asked for. Also how a test reads any setting from
an environment variable whose name has changed.

The same file is in each test folder whose tests read a setting from the
environment. There is no fallback to a skip, because a cloud test that
passes without calling the cloud has proved nothing.

Functions

 _report_old_name (name, old_name)
 read_environment (name, old_name)
 is_set (name, old_name)
 find_resource_key (names=RESOURCE_KEY_NAMES)
 no_resource_key (product, asks_for, several=False, names=RESOURCE_KEY_NAMES)
 answered_without (thing, reason, product)

Variables

tuple RESOURCE_KEY_NAMES
str OLD_RESOURCE_KEY_NAME = "resource_key"
 _reported_old_names = set()
tuple ACCESSIBLE_PROPERTIES_URL
str CREATE_KEY_URL = "https://configure.51degrees.com?utm_source=code&utm_medium=example&utm_campaign=51degrees-python&utm_content=live_cloud.py&utm_term=resource-key-required"

Function Documentation

◆ _report_old_name()

_report_old_name ( name,
old_name )
protected
Prints, once for each old name, that it is deprecated and which
name replaces it.

◆ answered_without()

answered_without ( thing,
reason,
product )
What to fail with when the cloud answered without the thing asked
for. reason is the cloud's null reason, or None when it gave none.

◆ find_resource_key()

find_resource_key ( names = RESOURCE_KEY_NAMES)
The first resource key set under any of the names, or None. When
none of RESOURCE_KEY_NAMES is set, the deprecated old name is read.

◆ is_set()

is_set ( name,
old_name )
Whether the environment variable name is set, whatever it holds,
which is how a switch is read. When it is not set, the name the
variable had before counts, and using it prints once that the old name
is deprecated.

◆ no_resource_key()

no_resource_key ( product,
asks_for,
several = False,
names = RESOURCE_KEY_NAMES )
What to fail with when no resource key is set.

product names the product the key has to carry, with its article, as in
"the device product". asks_for says what the test asks the service for.
several is true where the message stands for a group of tests.

◆ read_environment()

read_environment ( name,
old_name )
The value of the environment variable name, or None when it has
none. When name is unset or empty the name the variable had before is
read, and using it prints once that the old name is deprecated.

Variable Documentation

◆ _reported_old_names

tests.live_cloud._reported_old_names = set()
protected

◆ ACCESSIBLE_PROPERTIES_URL

tuple tests.live_cloud.ACCESSIBLE_PROPERTIES_URL
Initial value:
= (
"https://cloud.51degrees.com/api/v4/accessibleproperties?resource=<key>")

◆ CREATE_KEY_URL

str tests.live_cloud.CREATE_KEY_URL = "https://configure.51degrees.com?utm_source=code&utm_medium=example&utm_campaign=51degrees-python&utm_content=live_cloud.py&utm_term=resource-key-required"

◆ OLD_RESOURCE_KEY_NAME

str tests.live_cloud.OLD_RESOURCE_KEY_NAME = "resource_key"

◆ RESOURCE_KEY_NAMES

tuple tests.live_cloud.RESOURCE_KEY_NAMES
Initial value:
= (
"_51DEGREES_RESOURCE_KEY",
"_51DEGREES_RESOURCE_KEY_BESPOKE",
)