-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathtest_args.py
More file actions
55 lines (44 loc) · 1.2 KB
/
test_args.py
File metadata and controls
55 lines (44 loc) · 1.2 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
import os
import sys
import click
import pytest
from codecov_cli import __version__
from codecov_cli.helpers.args import get_cli_args
def test_get_cli_args():
ctx = click.Context(click.Command("do-upload"))
ctx.obj = {}
ctx.obj["cli_args"] = {
"verbose": True,
}
ctx.params = {
"branch": "fake_branch",
"token": "fakeTOKEN",
}
expected = {
"branch": "fake_branch",
"command": "do-upload",
"verbose": True,
"version": f"cli-{__version__}",
}
assert get_cli_args(ctx) == expected
@pytest.mark.skipif(sys.platform == "win32", reason="requires posix platform")
def test_get_cli_args_with_posix():
from pathlib import PosixPath
ctx = click.Context(click.Command("do-upload"))
ctx.obj = {}
ctx.obj["cli_args"] = {
"verbose": True,
}
ctx.params = {
"branch": "fake_branch",
"path": PosixPath(os.getcwd()),
"token": "fakeTOKEN",
}
expected = {
"branch": "fake_branch",
"command": "do-upload",
"path": str(PosixPath(os.getcwd())),
"verbose": True,
"version": f"cli-{__version__}",
}
assert get_cli_args(ctx) == expected