def hsm(module_id, module_generation_id, workload_uri, api_version): return IoTEdgeHsm( module_id=module_id, module_generation_id=module_generation_id, workload_uri=workload_uri, api_version=api_version, )
def test_workload_uri(self, module_id, module_generation_id, api_version): my_workload_uri = "unix:///var/run/iotedge/workload.sock" expected_workload_uri = "http+unix://%2Fvar%2Frun%2Fiotedge%2Fworkload.sock/" hsm = IoTEdgeHsm( module_id=module_id, module_generation_id=module_generation_id, workload_uri=my_workload_uri, api_version=api_version, ) assert hsm.workload_uri == expected_workload_uri
def test_module_id(self, module_generation_id, workload_uri, api_version): my_module_id = "not url //encoded" expected_module_id = urllib.parse.quote(my_module_id) hsm = IoTEdgeHsm( module_id=my_module_id, module_generation_id=module_generation_id, workload_uri=workload_uri, api_version=api_version, ) assert my_module_id != expected_module_id assert hsm.module_id == expected_module_id