forked from pythonpune/readit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_readit.py
53 lines (45 loc) · 2.05 KB
/
test_readit.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import pytest
from click.testing import CliRunner
from readit import cli as c
@pytest.fixture(scope="module")
def runner():
return CliRunner()
# Testing --version option
def test_version(runner):
result = runner.invoke(c.main, ['--version'])
assert not result.exception
assert result.exit_code == 0
expected = "readit v0.3\n"
assert result.output == expected
# Testing -V option
def test_by_version(runner):
result = runner.invoke(c.main, ['-V'])
assert not result.exception
assert result.exit_code == 0
expected = "readit v0.3\n"
assert result.output == expected
# Testing --help option
def test_help_option(runner):
"""testing the help of readit"""
result = runner.invoke(c.main, ['--help'])
assert not result.exception
assert result.exit_code == 0
expected_output = ("Usage: main [OPTIONS] [INSERT]...\n"
"\n"
" Readit - Command-line bookmark manager tool."
"\n\n"
"Options:\n"
" -a, --add TEXT... Add URLs with space-separated\n"
" -t, --tag TEXT... Add Tag with space-separated URL\n"
" -d, --delete TEXT Remove a URL of particular ID\n"
" -c, --clear TEXT... Clear bookmarks\n"
" -u, --update TEXT... Update a URL for specific ID\n"
" -s, --search TEXT Search all bookmarks by Tag\n"
" -v, --view TEXT... Show bookmarks\n"
" -o, --openurl TEXT Open URL in Browser\n"
" -V, --version Check latest version\n"
" -e, --export TEXT... Export URLs in csv file\n"
" -tl, --taglist TEXT... Show all Tags\n"
" -ui, --urlinfo TEXT Check particular URL information\n"
" --help Show this message and exit.\n")
assert result.output == expected_output