# Path: test/settings/mqttkit.py
# PROCESS_DELAY_MQTT = 0.3
# PROCESS_DELAY_HTTP = 0.3
# class TestSettings:
# 
# Path: test/util.py
# def mqtt_json_sensor(topic, data):
#     payload = json.dumps(data)
#     return mqtt_sensor(topic, payload)
# 
# def sleep(secs):
#     # https://gist.github.com/jhorman/891717
#     return deferLater(reactor, secs, lambda: None)


import json
import logging
import pytest
import pytest_twisted
from test.settings.mqttkit import influx_sensors, PROCESS_DELAY_MQTT
from test.util import mqtt_json_sensor, sleep
    """

    # Submit a single measurement.
    data = {
      "Time": "2019-06-02T22:13:07",
      "SonoffSC": {
        "Temperature": 25,
        "Humidity": 15,
        "Light": 20,
        "Noise": 10,
        "AirQuality": 90
      },
      "TempUnit": "C"
    }
    yield mqtt_json_sensor(tasmota_sensor_topic, data)

    # Wait for some time to process the message.
    yield sleep(PROCESS_DELAY_MQTT)

    # Define reference data.
    reference = {
      u'time': u'2019-06-02T20:13:07Z',
      u'SonoffSC.AirQuality': 90,
      u'SonoffSC.Humidity': 15,
      u'SonoffSC.Light': 20,
      u'SonoffSC.Noise': 10,
      u'SonoffSC.Temperature': 25,
    }

    # Proof that data arrived in InfluxDB.

# Path: test/settings/mqttkit.py
# PROCESS_DELAY_MQTT = 0.3
# PROCESS_DELAY_HTTP = 0.3
# class TestSettings:
# 
# Path: test/util.py
# def mqtt_json_sensor(topic, data):
#     payload = json.dumps(data)
#     return mqtt_sensor(topic, payload)
# 
# def sleep(secs):
#     # https://gist.github.com/jhorman/891717
#     return deferLater(reactor, secs, lambda: None)


# Path: test/test_tasmota.py
import json
import logging
import pytest
import pytest_twisted
from test.settings.mqttkit import influx_sensors, PROCESS_DELAY_MQTT
from test.util import mqtt_json_sensor, sleep

    """

    # Submit a single measurement.
    data = {
      "Time": "2019-06-02T22:13:07",
      "SonoffSC": {
        "Temperature": 25,
        "Humidity": 15,
        "Light": 20,
        "Noise": 10,
        "AirQuality": 90
      },
      "TempUnit": "C"
    }
    yield mqtt_json_sensor(tasmota_sensor_topic, data)

    # Wait for some time to process the message.
    yield sleep(PROCESS_DELAY_MQTT)

    # Define reference data.
    reference = {
      u'time': u'2019-06-02T20:13:07Z',
      u'SonoffSC.AirQuality': 90,
      u'SonoffSC.Humidity': 15,
      u'SonoffSC.Light': 20,
      u'SonoffSC.Noise': 10,
      u'SonoffSC.Temperature': 25,
    }

    # Proof that data arrived in InfluxDB.

    record = influx_sensors.get_first_record()