aboutsummaryrefslogtreecommitdiffstats
path: root/test_json_diff.py
diff options
context:
space:
mode:
Diffstat (limited to 'test_json_diff.py')
-rw-r--r--test_json_diff.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/test_json_diff.py b/test_json_diff.py
index 5ebfb89..95296e0 100644
--- a/test_json_diff.py
+++ b/test_json_diff.py
@@ -18,12 +18,14 @@ from test_strings import ARRAY_DIFF, ARRAY_NEW, ARRAY_OLD, \
NESTED_DIFF_IGNORING, \
SIMPLE_ARRAY_OLD, SIMPLE_DIFF, SIMPLE_DIFF_HTML, SIMPLE_NEW, SIMPLE_OLD
+
class OptionsClass(object):
def __init__(self, inc=None, exc=None, ign=None):
self.exclude = exc
self.include = inc
self.ignore_append = ign
+
class OurTestCase(unittest.TestCase):
def _run_test(self, oldf, newf, difff, msg="", opts=None):
diffator = json_diff.Comparator(oldf, newf, opts)
@@ -180,5 +182,25 @@ class TestMainArgsMgmt(unittest.TestCase):
self.assertEquals(observed[:len(expected)], expected,
"testing -h usage message")
+ def test_args_run_same(self):
+ save_stdout = StringIO()
+ sys.stdout = save_stdout
+
+ res = json_diff.main(["./test_json_diff.py",
+ "test/old.json", "test/old.json"])
+
+ sys.stdout = sys.__stdout__
+ self.assertEquals(res, 0, "testing -h usage message")
+
+ def test_args_run_different(self):
+ save_stdout = StringIO()
+ sys.stdout = save_stdout
+
+ res = json_diff.main(["./test_json_diff.py",
+ "test/old.json", "test/new.json"])
+
+ sys.stdout = sys.__stdout__
+ self.assertEquals(res, 1, "testing -h usage message")
+
if __name__ == "__main__":
unittest.main()