-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathtest_cli.py
More file actions
35 lines (22 loc) · 1021 Bytes
/
test_cli.py
File metadata and controls
35 lines (22 loc) · 1021 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
26
27
28
29
30
31
32
33
34
35
"""Tests the CLI interface for DomainTools APIs"""
import pytest
import os
from typer.testing import CliRunner
from domaintools.cli import dt_cli
from domaintools._version import current
runner = CliRunner()
def test_match_cli_version():
result = runner.invoke(dt_cli, ["--version"])
expected_res = f"DomainTools CLI API Client {current}"
assert expected_res == result.stdout.strip()
def test_valid_command():
user = os.environ.get("TEST_USER", "test")
key = os.environ.get("TEST_KEY", "key")
result = runner.invoke(dt_cli, ["account_information", "--help"])
assert "Provides a snapshot of your accounts current API usage." in result.stdout
def test_invalid_command():
result = runner.invoke(dt_cli, ["test_invalid_command"])
assert "No such command 'test_invalid_command'." in result.stdout
def test_no_creds_file_not_found():
result = runner.invoke(dt_cli, ["iris_investigate", "--domain", "domaintools.com"])
assert "No such file or directory" in result.stdout