# coding: utf-8 """ Emulation API The Emulation API facilitates the retrieval of user-agent strings for HTTP, pageload, and transaction tests. It also enables the retrieval and addition of emulated devices for pageload and transaction tests. To access Emulation API operations, the following permissions are required: * `Settings Tests Read` for read operations. * `Settings Tests Update` for write operations. Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. """ # noqa: E501 import json import unittest import thousandeyes_sdk.emulation.models from .test_utils import assert_constructed_model_matches_example_json from thousandeyes_sdk.emulation.api.emulation_api import EmulationApi class TestEmulationApi(unittest.TestCase): """EmulationApi unit test stubs""" def setUp(self) -> None: self.api = EmulationApi() def tearDown(self) -> None: pass def test_create_emulated_device_models_validation(self) -> None: """Test case for create_emulated_device request and response models""" request_body_json = """ { "width" : 1024, "category" : "desktop", "height" : 768 }""" request_loaded_json = json.loads(request_body_json) request_from_json = thousandeyes_sdk.emulation.models.EmulatedDevice.from_json(request_body_json) assert_constructed_model_matches_example_json(request_from_json, request_loaded_json) response_body_json = """ { "availableUserAgents" : [ "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Mobile Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Safari/537.36" ], "width" : 1024, "name" : "iPad Pro 12.9-in", "codeName" : "IPAD_PRO_12_9", "id" : "11", "category" : "desktop", "defaultUserAgentTemplate" : "Mozilla/5.0 (Android 4.4; Tablet; rv:70.0) Gecko/70.0 Firefox/70.0", "height" : 768 }""" response_loaded_json = json.loads(response_body_json) response_from_json = thousandeyes_sdk.emulation.models.EmulatedDeviceResponse.from_json(response_body_json) assert_constructed_model_matches_example_json(response_from_json, response_loaded_json) def test_get_emulated_devices_models_validation(self) -> None: """Test case for get_emulated_devices request and response models""" response_body_json = """ { "emulatedDevices" : [ { "availableUserAgents" : [ "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Mobile Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Safari/537.36" ], "width" : 1024, "name" : "iPad Pro 12.9-in", "codeName" : "IPAD_PRO_12_9", "id" : "11", "category" : "desktop", "defaultUserAgentTemplate" : "Mozilla/5.0 (Android 4.4; Tablet; rv:70.0) Gecko/70.0 Firefox/70.0", "height" : 768 }, { "availableUserAgents" : [ "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Mobile Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Safari/537.36" ], "width" : 1024, "name" : "iPad Pro 12.9-in", "codeName" : "IPAD_PRO_12_9", "id" : "11", "category" : "desktop", "defaultUserAgentTemplate" : "Mozilla/5.0 (Android 4.4; Tablet; rv:70.0) Gecko/70.0 Firefox/70.0", "height" : 768 } ], "_links" : { "self" : { "hreflang" : "hreflang", "templated" : true, "profile" : "profile", "name" : "name", "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", "type" : "type", "deprecation" : "deprecation", "title" : "title" } } }""" response_loaded_json = json.loads(response_body_json) response_from_json = thousandeyes_sdk.emulation.models.EmulatedDeviceResponses.from_json(response_body_json) assert_constructed_model_matches_example_json(response_from_json, response_loaded_json) def test_get_user_agents_models_validation(self) -> None: """Test case for get_user_agents request and response models""" response_body_json = """ { "_links" : { "self" : { "hreflang" : "hreflang", "templated" : true, "profile" : "profile", "name" : "name", "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", "type" : "type", "deprecation" : "deprecation", "title" : "title" } }, "userAgents" : [ { "os" : "Windows", "browser" : "Firefox", "value" : "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Mobile Safari/537.36" }, { "os" : "Windows", "browser" : "Firefox", "value" : "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Mobile Safari/537.36" } ] }""" response_loaded_json = json.loads(response_body_json) response_from_json = thousandeyes_sdk.emulation.models.UserAgents.from_json(response_body_json) assert_constructed_model_matches_example_json(response_from_json, response_loaded_json) if __name__ == '__main__': unittest.main()