51Degrees Pipeline for Python

tests.test_cloudrequestengine.TestCloudRequestEngine Class Reference

Detailed Description

Test cloud request engine adds correct information to post request following the order of precedence when processing evidence and returns the response in the ElementData.

Evidence parameters should be added in descending order of precedence.

Inheritance diagram for tests.test_cloudrequestengine.TestCloudRequestEngine:

[legend]

Collaboration diagram for tests.test_cloudrequestengine.TestCloudRequestEngine:

[legend]

Public Member Functions

 setUp (self)
 new_engine (self, **settings)
 A cloud request engine with the test resource key, a mock HTTP client and any other settings given.
 old_name_reports (self, caught)
 The warnings in a recorded list that say the old endpoint variable is deprecated and name the one that replaces it.
 testConfigEndPoint_ExplicitSetting (self)
 Check that the explicitly setting the cloud endpoint via method interface take precedence over everything else.
 testConfigEndPoint_EnvironmentVariableSetting (self)
 Check that the setting the cloud endpoint via environment variable take precedence over the default value.
 testConfigEndPoint_DefaultSetting (self)
 Check that if nothing else is set the default value should be used.
 testConfigEndPoint_OldEnvironmentVariable (self)
 Check that the old name of the endpoint environment variable is still read when the new name is not set.
 testConfigEndPoint_OldEnvironmentVariable_NewNameEmpty (self)
 Check that the old name is read when the new name is set to an empty value, which counts as not set.
 testConfigEndPoint_OldEnvironmentVariable_Empty (self)
 Check that the default is used when the old name is set to an empty value and the new name is not set, with nothing reported.
 testConfigEndPoint_NewEnvironmentVariableWins (self)
 Check that the new name wins when both names are set, and that the old name is not reported because it was not used.
 testConfigEndPoint_ExplicitSettingOverOldEnvironmentVariable (self)
 Check that the cloud_endpoint setting wins over the old name, and that the old name is not reported because it was not used.
 testConfigEndPoint_OldEnvironmentVariableReportedOnce (self)
 Check that using the old name is reported as deprecated once, naming the new name, however many engines are built.
 testOldEndPointConstant (self)
 Check that the constant the old name was held in is still there with its old value, as a plain attribute of its class, so that every way of reading it gives the old name.
 testConfigEndPoint_VariableTheOldConstantNames (self)
 Check that the engine reads the old name through the constant, as it did before, so that code which points the constant at another variable still decides what is read.
 testEndPointConstant (self)
 Check that the constant for the new name holds the new name.
 test_evidence_precedence (self, warn, evidence1, evidence2)
 Test cloud request engine adds correct information to post request following the order of precedence when processing evidence and returns the response in the ElementData.
 test_get_selected_evidence (self, evidence, ev_type, expected_value)
 Test evidence of specific type is returned from all the evidence passed, if type is not from query, header or cookie then evidences are returned sorted in descensing order.
 test_get_content (self, evidence, expected_value)
 Test Content to send in the POST request is generated as per the precedence rule of The evidence keys.
 test_no_exception_on_cloud_request_engine_init (self)
 test_exception_on_server_down_without_suppression (self)
 test_no_exception_on_server_down_with_suppression (self)

Static Public Attributes

str testResourceKey = "resource_key"
str testEndPoint = "http://testEndPoint/"
str testEnvVarEndPoint = "http://testEnvVarEndPoint/"
str testOldEnvVarEndPoint = "http://testOldEnvVarEndPoint/"
str oldEndPointVariable = "FOD_CLOUD_API_URL"

Member Function Documentation

◆ new_engine()

tests.test_cloudrequestengine.TestCloudRequestEngine.new_engine ( self,
** settings )

A cloud request engine with the test resource key, a mock HTTP client and any other settings given.

◆ old_name_reports()

tests.test_cloudrequestengine.TestCloudRequestEngine.old_name_reports ( self,
caught )

The warnings in a recorded list that say the old endpoint variable is deprecated and name the one that replaces it.

◆ setUp()

tests.test_cloudrequestengine.TestCloudRequestEngine.setUp ( self)

◆ test_evidence_precedence()

tests.test_cloudrequestengine.TestCloudRequestEngine.test_evidence_precedence ( self,
warn,
evidence1,
evidence2 )

Test cloud request engine adds correct information to post request following the order of precedence when processing evidence and returns the response in the ElementData.

Evidence parameters should be added in descending order of precedence.

◆ test_exception_on_server_down_without_suppression()

tests.test_cloudrequestengine.TestCloudRequestEngine.test_exception_on_server_down_without_suppression ( self)

◆ test_get_content()

tests.test_cloudrequestengine.TestCloudRequestEngine.test_get_content ( self,
evidence,
expected_value )

Test Content to send in the POST request is generated as per the precedence rule of The evidence keys.

These are added to the evidence in reverse order, if there is conflict then the queryData value is overwritten.

◆ test_get_selected_evidence()

tests.test_cloudrequestengine.TestCloudRequestEngine.test_get_selected_evidence ( self,
evidence,
ev_type,
expected_value )

Test evidence of specific type is returned from all the evidence passed, if type is not from query, header or cookie then evidences are returned sorted in descensing order.

◆ test_no_exception_on_cloud_request_engine_init()

tests.test_cloudrequestengine.TestCloudRequestEngine.test_no_exception_on_cloud_request_engine_init ( self)
Test no exception is thrown when cloud request engine is
initialised and server is down

◆ test_no_exception_on_server_down_with_suppression()

tests.test_cloudrequestengine.TestCloudRequestEngine.test_no_exception_on_server_down_with_suppression ( self)

◆ testConfigEndPoint_DefaultSetting()

tests.test_cloudrequestengine.TestCloudRequestEngine.testConfigEndPoint_DefaultSetting ( self)

Check that if nothing else is set the default value should be used.

◆ testConfigEndPoint_EnvironmentVariableSetting()

tests.test_cloudrequestengine.TestCloudRequestEngine.testConfigEndPoint_EnvironmentVariableSetting ( self)

Check that the setting the cloud endpoint via environment variable take precedence over the default value.

◆ testConfigEndPoint_ExplicitSetting()

tests.test_cloudrequestengine.TestCloudRequestEngine.testConfigEndPoint_ExplicitSetting ( self)

Check that the explicitly setting the cloud endpoint via method interface take precedence over everything else.

◆ testConfigEndPoint_ExplicitSettingOverOldEnvironmentVariable()

tests.test_cloudrequestengine.TestCloudRequestEngine.testConfigEndPoint_ExplicitSettingOverOldEnvironmentVariable ( self)

Check that the cloud_endpoint setting wins over the old name, and that the old name is not reported because it was not used.

◆ testConfigEndPoint_NewEnvironmentVariableWins()

tests.test_cloudrequestengine.TestCloudRequestEngine.testConfigEndPoint_NewEnvironmentVariableWins ( self)

Check that the new name wins when both names are set, and that the old name is not reported because it was not used.

◆ testConfigEndPoint_OldEnvironmentVariable()

tests.test_cloudrequestengine.TestCloudRequestEngine.testConfigEndPoint_OldEnvironmentVariable ( self)

Check that the old name of the endpoint environment variable is still read when the new name is not set.

◆ testConfigEndPoint_OldEnvironmentVariable_Empty()

tests.test_cloudrequestengine.TestCloudRequestEngine.testConfigEndPoint_OldEnvironmentVariable_Empty ( self)

Check that the default is used when the old name is set to an empty value and the new name is not set, with nothing reported.

◆ testConfigEndPoint_OldEnvironmentVariable_NewNameEmpty()

tests.test_cloudrequestengine.TestCloudRequestEngine.testConfigEndPoint_OldEnvironmentVariable_NewNameEmpty ( self)

Check that the old name is read when the new name is set to an empty value, which counts as not set.

◆ testConfigEndPoint_OldEnvironmentVariableReportedOnce()

tests.test_cloudrequestengine.TestCloudRequestEngine.testConfigEndPoint_OldEnvironmentVariableReportedOnce ( self)

Check that using the old name is reported as deprecated once, naming the new name, however many engines are built.

◆ testConfigEndPoint_VariableTheOldConstantNames()

tests.test_cloudrequestengine.TestCloudRequestEngine.testConfigEndPoint_VariableTheOldConstantNames ( self)

Check that the engine reads the old name through the constant, as it did before, so that code which points the constant at another variable still decides what is read.

◆ testEndPointConstant()

tests.test_cloudrequestengine.TestCloudRequestEngine.testEndPointConstant ( self)

Check that the constant for the new name holds the new name.

◆ testOldEndPointConstant()

tests.test_cloudrequestengine.TestCloudRequestEngine.testOldEndPointConstant ( self)

Check that the constant the old name was held in is still there with its old value, as a plain attribute of its class, so that every way of reading it gives the old name.

Member Data Documentation

◆ oldEndPointVariable

tests.test_cloudrequestengine.TestCloudRequestEngine.oldEndPointVariable = "FOD_CLOUD_API_URL"
static

◆ testEndPoint

tests.test_cloudrequestengine.TestCloudRequestEngine.testEndPoint = "http://testEndPoint/"
static

◆ testEnvVarEndPoint

tests.test_cloudrequestengine.TestCloudRequestEngine.testEnvVarEndPoint = "http://testEnvVarEndPoint/"
static

◆ testOldEnvVarEndPoint

tests.test_cloudrequestengine.TestCloudRequestEngine.testOldEnvVarEndPoint = "http://testOldEnvVarEndPoint/"
static

◆ testResourceKey

str tests.test_cloudrequestengine.TestCloudRequestEngine.testResourceKey = "resource_key"
static