Beispiel #1
0
def test_argument_alternative_command():
    assert ding.get_args(['in', '1s', '--command', 'beep'])
    assert ding.get_args(['in', '1s', '-c', 'beep'])
Beispiel #2
0
def test_argument_inexistent():
    with pytest.raises(SystemExit) as excinfo:
        assert ding.get_args(['in', '1s', '--inexistent-argument'])
Beispiel #3
0
def test_argument_no_timer():
    assert ding.get_args(['in', '1s', '--no-timer'])
    assert ding.get_args(['in', '1s', '-n'])
Beispiel #4
0
def test_time_a_second_in_the_past():
    a_second_ago = datetime.datetime.now() - datetime.timedelta(seconds=1)
    time_str = str(a_second_ago.time()).split('.')[0]
    assert ding.get_args(['at', time_str])
Beispiel #5
0
def test_at_characters_in_string():
    with pytest.raises(SystemExit) as excinfo:
        assert ding.get_args(['at', '22a:71'])
Beispiel #6
0
def test_notimer_not_at_end():
    with pytest.raises(SystemExit) as excinfo:
        assert ding.get_args(['--no-timer', 'in', '1s'])
Beispiel #7
0
def test_at_invalid_hour():
    with pytest.raises(SystemExit) as excinfo:
        assert ding.get_args(['at', '25'])
Beispiel #8
0
def test_at_invalid_minute():
    with pytest.raises(SystemExit) as excinfo:
        assert ding.get_args(['at', '22:71'])
Beispiel #9
0
def test_in_partly_wrong_suffix():
    with pytest.raises(SystemExit) as excinfo:
        assert ding.get_args(['in', '1s', '1x'])
Beispiel #10
0
def test_at_invalid_separator():
    with pytest.raises(SystemExit) as excinfo:
        assert ding.get_args(['in', '15', '30'])
Beispiel #11
0
def test_insufficient_arguments_at():
    with pytest.raises(SystemExit) as excinfo:
        assert ding.get_args(['every'])
Beispiel #12
0
def test_no_arguments():
    with pytest.raises(SystemExit) as excinfo:
        assert ding.get_args([])
Beispiel #13
0
def test_time_in_1h_1m_1s():
    assert ding.get_args(['in', '1h', '1m', '1s'])
Beispiel #14
0
def test_time_in_1m():
    assert ding.get_args(['in', '1h'])
Beispiel #15
0
def test_time_a_minute_in_the_future():
    a_second_ago = datetime.datetime.now() + datetime.timedelta(minutes=1)
    time_str = str(a_second_ago.time()).split('.')[0]
    assert ding.get_args(['at', time_str])