def test_register_with_id(server, base_url, uuid, uuid_obj): def on_data(*args): pass def on_signal(*args): pass context = dan.register( base_url, id_=uuid, on_signal=on_signal, on_data=on_data, accept_protos=['mqtt'], idf_list=[('acce', ['m/s^s', 'm/s^2', 'm/s^2'])], odf_list=[('meow', ['dB'])], name='test da', ) assert context.url == base_url assert context.rev is not None assert context.app_id == uuid_obj assert context.mqtt_host is not None assert context.mqtt_port is not None assert isinstance(context.mqtt_client, mqtt.Client) assert context.on_signal is on_signal assert context.on_data is on_data
def test_register_deregister(server, base_url): def on_data(*args): pass def on_signal(*args): pass context = dan.register( base_url, on_signal=on_signal, on_data=on_data, accept_protos=['mqtt'], idf_list=[('acce', ['m/s^s', 'm/s^2', 'm/s^2'])], odf_list=[('meow', ['dB'])], name='test da', ) assert context.url == base_url assert context.rev is not None assert isinstance(context.app_id, UUID) assert context.mqtt_host is not None assert context.mqtt_port is not None assert isinstance(context.mqtt_client, mqtt.Client) assert context.on_signal is on_signal assert context.on_data is on_data dan.deregister() dan.wait_until_deregister() assert context.mqtt_client is None