forked from DomainTools/python_api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_cli.py
More file actions
25 lines (18 loc) · 884 Bytes
/
test_cli.py
File metadata and controls
25 lines (18 loc) · 884 Bytes
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
"""Tests the CLI interface for DomainTools' APIs"""
import pytest
from domaintools import cli, __version__
def test_domain_search():
(out_file, out_format, arguments) = cli.parse(['domain_search', 'google', '--anchor-right', 'true'])
assert out_format == 'json'
assert arguments['api_call'] == 'domain_search'
assert arguments['query'] == 'google'
assert arguments['anchor_right'] == 'true'
def test_not_authenticated():
(out_file, out_format, arguments) = cli.parse(args=['-c', 'non-existent', 'domain_search', 'google',
'--max-length', '100'])
assert out_format == 'json'
assert not arguments.get('user', None)
assert not arguments.get('key', None)
def test_stream_in():
with pytest.raises((OSError, IOError)):
cli.parse(['domain_search', 'google', '--max-length', '-'])