Beispiel #1
0
def test_last_hour():
    """Helpers - Last Hour"""
    time_now = int(time.time())

    thirty_minutes_ago = time_now - 1800
    assert_equal(base.last_hour(thirty_minutes_ago), True)

    one_hour_ago = time_now - 3600
    assert_equal(base.last_hour(one_hour_ago), True)

    two_hours_ago = time_now - 7200
    assert_equal(base.last_hour(two_hours_ago), False)
Beispiel #2
0
def sample_kv_rule_last_hour(rec):
    return (
        rec['type'] == 'start' and
        rec['uid'] == 0 and
        last_hour(rec['time'])
    )