From 56053103625af6fb7fa749fc5bc3dbdc62fc223c Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Sun, 8 Mar 2020 14:02:54 -0700 Subject: [PATCH] added tests, removed os import, changed to 'assertEqual' --- tests/test_cli.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index 69542f6f..fdd768da 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,4 +1,3 @@ -import os import unittest import jc.cli @@ -6,9 +5,17 @@ import jc.cli class MyTests(unittest.TestCase): def test_cli(self): commands = { - "jc -p systemctl list-sockets": "systemctl list-sockets | jc --systemctl-ls -p", - "jc -p systemctl list-unit-files": "systemctl list-unit-files | jc --systemctl-luf -p", + 'jc -p systemctl list-sockets': 'systemctl list-sockets | jc --systemctl-ls -p', + 'jc -p systemctl list-unit-files': 'systemctl list-unit-files | jc --systemctl-luf -p', + 'jc -p pip list': 'pip list | jc --pip-list -p', + 'jc -p pip3 list': 'pip3 list | jc --pip-list -p', + 'jc -p pip show jc': 'pip show jc | jc --pip-show -p', + 'jc -p pip3 show jc': 'pip3 show jc | jc --pip-show -p', + 'jc -prd last': 'last | jc --last -prd', + 'jc -prd lastb': 'lastb | jc --last -prd', + 'jc -p nonexistent command': 'nonexistent command', + 'jc -ap': None } for command, expected_command in commands.items(): - self.assertEquals(jc.cli.generate_magic_command(command.split(" "))[1], expected_command) + self.assertEqual(jc.cli.generate_magic_command(command.split(' '))[1], expected_command)