Skip to content

Commit

Permalink
Added test file for helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
fmauch committed Jul 21, 2023
1 parent 2db1846 commit 6a7a08e
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/test_helpers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import os

from catmux.session import check_boolean_field
from catmux.tmux_wrapper import _safe_call as safe_call


def test_boolean_field():
assert check_boolean_field("yes") == True
assert check_boolean_field("Yes") == True
assert check_boolean_field("YES") == True
assert check_boolean_field("true") == True
assert check_boolean_field("True") == True
assert check_boolean_field("TRUE") == True
assert check_boolean_field("t") == True
assert check_boolean_field("T") == True
assert check_boolean_field("1") == True
assert check_boolean_field("no") == False
assert check_boolean_field("No") == False
assert check_boolean_field("NO") == False
assert check_boolean_field("false") == False
assert check_boolean_field("False") == False
assert check_boolean_field("FALSE") == False
assert check_boolean_field(True) == True
assert check_boolean_field(False) == False


def test_safe_call():
assert safe_call(["bash", "-c", "exit 0"]) == True
assert safe_call(["bash", "-c", "exit 1"]) == False
assert safe_call(["bash", "-c", "return 0"]) == False # illegal bash

0 comments on commit 6a7a08e

Please sign in to comment.