Ejemplo n.º 1
0
def test_parse_timespec0005(monkeypatch):
    """Test parsing minutes"""

    freeze_time(monkeypatch)
    tf = TimeFilter.from_arg("2M:1M")
    assert tf.start == TimeFilter.now() - timedelta(minutes=2)
    assert tf.stop == TimeFilter.now() - timedelta(minutes=1)
Ejemplo n.º 2
0
def test_parse_timespec0004(monkeypatch):
    """Test parsing hours"""

    freeze_time(monkeypatch)
    tf = TimeFilter.from_arg("2h:1h")
    assert tf.start == TimeFilter.now() - timedelta(hours=2)
    assert tf.stop == TimeFilter.now() - timedelta(hours=1)
Ejemplo n.º 3
0
def test_parse_timespec0002(monkeypatch):
    """Test parsing months"""

    freeze_time(monkeypatch)
    tf = TimeFilter.from_arg("2m:1m")
    assert tf.start == TimeFilter.now() - timedelta(days=2 * 31)
    assert tf.stop == TimeFilter.now() - timedelta(days=31)
Ejemplo n.º 4
0
def test_parse_timespec0003(monkeypatch):
    """Test parsing days"""

    freeze_time(monkeypatch)
    tf = TimeFilter.from_arg("2d:1d")
    assert tf.start == TimeFilter.now() - timedelta(days=2)
    assert tf.stop == TimeFilter.now() - timedelta(days=1)
Ejemplo n.º 5
0
def test_parse_timespec0001(monkeypatch):
    """Test parsing years"""

    freeze_time(monkeypatch)
    tf = TimeFilter.from_arg("2y:1y")
    assert tf.start == TimeFilter.now() - timedelta(days=2 * 365)
    assert tf.stop == TimeFilter.now() - timedelta(days=365)