Device Detection services for 51Degrees Pipeline

tests.test_hardwareprofile_cloud Namespace Reference

Detailed Description

These tests run against fixed cloud responses, so they need no network connection and no resource key.

They cover the case that used to stop the TAC and native model examples with an AttributeError, which is a resource key that returns the hardware profiles but is not entitled to the hardware properties themselves.

Classes

class  _FakeCloudElementData
 Stands in for the element data the cloud request engine publishes. More...
class  _FakeFlowData
 Stands in for a FlowData carrying a fixed cloud response, so the engine can be tested with no network connection and no resource key. More...
class  HardwareProfileCloudTests

Functions

 _process (response)
 Run a fixed cloud response through the hardware profile engine and return the resulting element data.

Variables

 NOT_ENTITLED_RESPONSE
 ENTITLED_RESPONSE
 NO_HARDWARE_RESPONSE = json.dumps({"device": {"ismobile": True}})

Function Documentation

◆ _process()

_process ( response)
protected

Run a fixed cloud response through the hardware profile engine and return the resulting element data.

Variable Documentation

◆ ENTITLED_RESPONSE

tests.test_hardwareprofile_cloud.ENTITLED_RESPONSE
Initial value:
= json.dumps({
"hardware": {
"profiles": [
{
"hardwarevendor": "Apple",
"hardwarename": ["iPhone 6"],
"hardwaremodel": "A1586"
}
]
}
})

◆ NO_HARDWARE_RESPONSE

tests.test_hardwareprofile_cloud.NO_HARDWARE_RESPONSE = json.dumps({"device": {"ismobile": True}})

◆ NOT_ENTITLED_RESPONSE

tests.test_hardwareprofile_cloud.NOT_ENTITLED_RESPONSE
Initial value:
= json.dumps({
"hardware": {
"profiles": [
{"devicetype": "SmartPhone", "ismobile": True}
],
"hardwarevendor": None,
"hardwarevendornullreason":
"HardwareVendor is a paid feature. You need a licence key to "
"retrieve data.",
"hardwarename": None,
"hardwarenamenullreason":
"HardwareName is a paid feature. You need a licence key to "
"retrieve data.",
"hardwaremodel": None,
"hardwaremodelnullreason":
"HardwareModel is a paid feature. You need a licence key to "
"retrieve data."
}
})