-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtest_codecov_cli.py
More file actions
65 lines (57 loc) · 1.74 KB
/
test_codecov_cli.py
File metadata and controls
65 lines (57 loc) · 1.74 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
import pytest
from click.testing import CliRunner
from codecov_cli import main
from codecov_cli.helpers import request as request_module
def test_existing_commands():
assert sorted(main.cli.commands.keys()) == [
"create-commit",
"create-report",
"create-report-results",
"do-upload",
"empty-upload",
"get-report-results",
"label-analysis",
"pr-base-picking",
"process-test-results",
"send-notifications",
"static-analysis",
"upload-coverage",
"upload-process",
]
class TestHttpHeaderOption:
@pytest.fixture(autouse=True)
def reset_extra_headers(self):
request_module._extra_headers = {}
yield
request_module._extra_headers = {}
def test_http_header_valid(self):
runner = CliRunner()
result = runner.invoke(
main.cli,
[
"--http-header",
"CF-Access-Client-Id:abc123",
"--http-header",
"CF-Access-Client-Secret:xyz789",
"--help",
],
obj={},
)
assert result.exit_code == 0
def test_http_header_invalid_format(self):
runner = CliRunner()
result = runner.invoke(
main.cli,
["--http-header", "InvalidHeader", "do-upload", "--help"],
obj={},
)
assert result.exit_code != 0
assert "Invalid header format" in result.output
def test_http_header_value_with_colon(self):
runner = CliRunner()
result = runner.invoke(
main.cli,
["--http-header", "X-Test:value:with:colons", "--help"],
obj={},
)
assert result.exit_code == 0