Esempio n. 1
0
 def test_instantiates_with_connection_string_no_shared_access_key(self):
     connection_string = (
         "HostName={hostname};DeviceId={device_id};SharedAccessKeyName={skn}"
         .format(hostname=fake_hostname,
                 device_id=fake_device_id,
                 skn=fake_shared_access_key_name))
     with pytest.raises(ValueError):
         IoTHubHttpRuntimeManager.from_connection_string(connection_string)
Esempio n. 2
0
    def test_connection_string_auth(self, connection_string):
        client = IoTHubHttpRuntimeManager.from_connection_string(
            connection_string=connection_string)

        assert repr(client.auth) == connection_string
        assert client.protocol.config.base_url == "https://" + client.auth[
            "HostName"]
        assert client.protocol.config.credentials == client.auth
 def test_instantiates_with_connection_string_no_device_id(self):
     connection_string = (
         "HostName={hostname};SharedAccessKeyName={skn};SharedAccessKey={sk}".format(
             hostname=fake_hostname, skn=fake_shared_access_key_name, sk=fake_shared_access_key
         )
     )
     obj = IoTHubHttpRuntimeManager.from_connection_string(connection_string)
     assert isinstance(obj, IoTHubHttpRuntimeManager)
def iothub_http_runtime_manager():
    connection_string = "HostName={hostname};DeviceId={device_id};SharedAccessKeyName={skn};SharedAccessKey={sk}".format(
        hostname=fake_hostname,
        device_id=fake_device_id,
        skn=fake_shared_access_key_name,
        sk=fake_shared_access_key,
    )
    iothub_http_runtime_manager = IoTHubHttpRuntimeManager.from_connection_string(connection_string)
    return iothub_http_runtime_manager
Esempio n. 5
0
 def test_instantiates_with_empty_connection_string(self):
     with pytest.raises(ValueError):
         IoTHubHttpRuntimeManager.from_connection_string("")