test_sensor.py 441 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
"""Tests for the Sensor module."""
import nrm
import nrm.sensor
import pytest


@pytest.fixture
def sensor_manager():
    """Fixture for a regular sensor manager."""
    return nrm.sensor.SensorManager()


def test_sensor_update_returns_valid_data(sensor_manager):
    sensor_manager.start()
    data = sensor_manager.do_update()
16 17 18
    assert 'energy' in data
    assert 'power' in data['energy']
    assert 'total' in data['energy']['power']