BLAAAAAAAAAACK

This commit is contained in:
Jules Lasne (jlasne - seluj78) 2020-10-14 13:47:41 +02:00
parent d59e595d12
commit e57fa7825c
3 changed files with 32 additions and 14 deletions

View File

@ -31,7 +31,9 @@ def check_args(
exit(1)
if json_format and is_interactive:
print("Potodo: Json format and interactive modes cannot be activated at the same time.")
print(
"Potodo: Json format and interactive modes cannot be activated at the same time."
)
exit(1)
if is_interactive:
@ -40,14 +42,20 @@ def check_args(
except ImportError:
import platform
print('Potodo: "{}" is not supported for interactive mode'.format(platform.system()))
print(
'Potodo: "{}" is not supported for interactive mode'.format(
platform.system()
)
)
if exclude_fuzzy and only_fuzzy:
print("Potodo: Cannot pass --exclude-fuzzy and --only-fuzzy at the same time.")
exit(1)
if exclude_reserved and only_reserved:
print("Potodo: Cannot pass --exclude-reserved and --only-reserved at the same time.")
print(
"Potodo: Cannot pass --exclude-reserved and --only-reserved at the same time."
)
exit(1)
# If no path is specified, use current directory

View File

@ -34,41 +34,52 @@ class TestPotodoArgsErrors:
assert output == output_short
assert "-h, --help show this help message and exit" in output
# TODO: Find a better way of testing help output
def test_potodo_above_below_conflict(self):
try:
check_output(["potodo", "--above", "50", "--below", "40"]).decode("utf-8")
except CalledProcessError as e:
output = e.output
try:
check_output(["potodo", "-a", "50", "-b", "40"]).decode("utf-8")
check_output(["potodo", "-a", "50", "-b", "40"]).decode("utf-8")
except CalledProcessError as e:
output_short = e.output
assert output == output_short
assert output == b"Potodo: 'below' value must be greater than 'above' value.\n"
def test_potodo_json_interactive_conflict(self):
try:
check_output(["potodo", "--json", "--interactive"]).decode("utf-8")
except CalledProcessError as e:
output = e.output
try:
check_output(["potodo", "-j", "-i"]).decode("utf-8")
check_output(["potodo", "-j", "-i"]).decode("utf-8")
except CalledProcessError as e:
output_short = e.output
assert output == output_short
assert output == b"Potodo: Json format and interactive modes cannot be activated at the same time.\n"
assert (
output
== b"Potodo: Json format and interactive modes cannot be activated at the same time.\n"
)
def test_potodo_exclude_and_only_fuzzy_conflict(self):
try:
check_output(["potodo", "--exclude-fuzzy", "--only-fuzzy"]).decode("utf-8")
except CalledProcessError as e:
output = e.output
assert output == b"Potodo: Cannot pass --exclude-fuzzy and --only-fuzzy at the same time.\n"
assert (
output
== b"Potodo: Cannot pass --exclude-fuzzy and --only-fuzzy at the same time.\n"
)
def test_potodo_exclude_and_only_reserved_conflict(self):
try:
check_output(["potodo", "--exclude-reserved", "--only-reserved"]).decode("utf-8")
check_output(["potodo", "--exclude-reserved", "--only-reserved"]).decode(
"utf-8"
)
except CalledProcessError as e:
output = e.output
assert output == b"Potodo: Cannot pass --exclude-reserved and --only-reserved at the same time.\n"
assert (
output
== b"Potodo: Cannot pass --exclude-reserved and --only-reserved at the same time.\n"
)

View File

@ -127,4 +127,3 @@ class TestPotodoCLI:
# TODO: Test hide_reserved, offline options, only_reserved, exclude_reserved, show_reservation_dates
# TODO: Test verbose output levels