Example #1
0
async def test_get_goal_temp(monkeypatch):
    """Test get_goal_temp()."""

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

    _data = _mock.data_request_vehicle()
    _data["climate_state"]["driver_temp_setting"] = 23.4
    _climate = Climate(_data, _controller)

    await _climate.async_update()

    assert not _climate.get_goal_temp() is None
    assert _climate.get_goal_temp() == 23.4
Example #2
0
async def test_set_temperature(monkeypatch):
    """Test set_temperature()."""

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

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

    await _climate.async_update()

    await _climate.set_temperature(12.3)

    assert not _climate.get_goal_temp() is None
    assert _climate.get_goal_temp() == 12.3
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"
Example #4
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