-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_client_argv.py
More file actions
45 lines (28 loc) · 1.37 KB
/
test_client_argv.py
File metadata and controls
45 lines (28 loc) · 1.37 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
# This Python file uses the following encoding: utf-8
import pytest
import logging
from jim_client import parse_client_args
logging.disable(logging.CRITICAL)
def test_parse_client_args():
argv = ("client_main.py",)
assert parse_client_args(argv) == (None, None, None)
argv = ("client_main.py", "-r")
assert parse_client_args(argv) == (None, None, True)
argv = ("client_main.py", "-w")
assert parse_client_args(argv) == (None, None, False)
argv = ("client_main.py", "-a")
assert parse_client_args(argv) == (None, None, None)
argv = ("client_main.py", "-p")
assert parse_client_args(argv) == (None, None, None)
argv = ("client_main.py", "-a", "localhost")
assert parse_client_args(argv) == ("localhost", None, None)
argv = ("client_main.py", "-p", "7777")
assert parse_client_args(argv) == (None, 7777, None)
argv = ("client_main.py", "-p", "XXX")
assert parse_client_args(argv) == (None, None, None)
argv = ("client_main.py", "-a", "localhost", "-p", "7777")
assert parse_client_args(argv) == ("localhost", 7777, None)
argv = ("client_main.py", "-r", "-a", "localhost", "-p", "7777")
assert parse_client_args(argv) == ("localhost", 7777, True)
argv = ("client_main.py", "-w", "-a", "localhost", "-p", "7777")
assert parse_client_args(argv) == ("localhost", 7777, False)