diff: make --checksums work with --json-show

This commit is contained in:
Mr. Outis
2020-01-27 14:10:37 -06:00
parent fced1718cc
commit 423a6163bc
2 changed files with 48 additions and 32 deletions
+21 -3
View File
@@ -1,5 +1,3 @@
import json
from dvc.cli import parse_args
@@ -56,4 +54,24 @@ def test_json(mocker, caplog):
mocker.patch("dvc.repo.Repo.diff", return_value=diff)
assert 0 == cmd.run()
assert json.dumps(diff) in caplog.text
assert (
'{"added": [{"filename": "file"}], "deleted": [], "modified": []}'
in caplog.text
)
def test_json_checksums(mocker, caplog):
args = parse_args(["diff", "--show-json", "--checksums"])
cmd = args.func(args)
diff = {
"added": [{"filename": "file", "checksum": "00000000"}],
"deleted": [],
"modified": [],
}
mocker.patch("dvc.repo.Repo.diff", return_value=diff)
assert 0 == cmd.run()
assert (
'{"added": [{"filename": "file", "checksum": "00000000"}], '
'"deleted": [], "modified": []}' in caplog.text
)