forked from mme/langforge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_cli.py
21 lines (15 loc) · 832 Bytes
/
test_cli.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import unittest
import subprocess
class TestLangforgeCLI(unittest.TestCase):
def test_help_output(self):
command = "langforge -h"
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, shell=True)
# Check the return code
self.assertEqual(result.returncode, 0, f"Expected return code 0, but got {result.returncode}")
# Check if the output contains the expected text
expected_text = "Usage:\n langforge [command]"
self.assertIn(expected_text, result.stdout, f"Expected output to contain '{expected_text}', but got '{result.stdout.strip()}'")
# Check for no errors
self.assertEqual(result.stderr.strip(), "", f"Expected no errors, but got '{result.stderr.strip()}'")
if __name__ == "__main__":
unittest.main()