Example #1
0
async def test_get_current_temp(monkeypatch):
    """Test get_current_temp()."""

    _mock = TeslaMock(monkeypatch)
    _controller = Controller(None)

    _data = _mock.data_request_vehicle()
    _data["climate_state"]["inside_temp"] = 18.8
    _climate = Climate(_data, _controller)

    await _climate.async_update()

    assert not _climate.get_current_temp() is None
    assert _climate.get_current_temp() == 18.8
Example #2
0
def test_get_values_on_init(monkeypatch):
    """Test values after initialization."""

    _mock = TeslaMock(monkeypatch)
    _controller = Controller(None)

    _data = _mock.data_request_vehicle()
    _climate = Climate(_data, _controller)

    assert _climate is not None
    assert _climate.get_current_temp() is None
    assert _climate.get_fan_status() is None
    assert _climate.get_goal_temp() is None
    assert _climate.is_hvac_enabled() is None
    assert _climate.preset_mode is None
Example #3
0
async def test_get_values_after_update(monkeypatch):
    """Test values after an update."""

    _mock = TeslaMock(monkeypatch)
    _controller = Controller(None)

    _data = _mock.data_request_vehicle()
    _climate = Climate(_data, _controller)

    await _climate.async_update()

    assert _climate is not None

    assert _climate.get_current_temp() is None
    assert not _climate.get_fan_status() is None
    assert _climate.get_fan_status() == 0
    assert not _climate.get_goal_temp() is None
    assert _climate.get_goal_temp() == 21.6
    assert not _climate.is_hvac_enabled() is None
    assert not _climate.is_hvac_enabled()
    assert _climate.preset_mode is not None
    assert _climate.preset_mode == "normal"