예제 #1
0
def test_timer_active_check(hass, spec, now, expected):
    """Run time active check tests."""

    Function.init(hass)
    TrigTime.init(hass)
    out = TrigTime.timer_active_check(spec, now)
    assert out == expected
예제 #2
0
def test_timer_active_check(hass, spec, now, expected):
    """Run time active check tests."""

    #
    # Hardcode a location and timezone so we can check sunrise
    # and sunset.
    #
    hass.config.latitude = 38
    hass.config.longitude = -122
    hass.config.elevation = 0
    hass.config.time_zone = "America/Los_Angeles"

    startup_time = dt(2019, 9, 1, 13, 0, 0, 0)
    Function.init(hass)
    TrigTime.init(hass)
    print(f"calling timer_active_check({spec}, {now}, {startup_time})")
    out = TrigTime.timer_active_check(spec, now, startup_time)
    assert out == expected