1010#
1111# ===----------------------------------------------------------------------===#
1212
13+ import json
14+
1315from . import scheme_mock
1416
1517
@@ -25,9 +27,16 @@ def test_dump_hashes_json(self):
2527 '--source-root' , self .source_root ,
2628 '--clone' ])
2729
28- # Then dump the hashes. Just make sure we don't crash. We should test
29- # the output as well. But we should never crash.
30- self .call ([self .update_checkout_path ,
31- '--config' , self .config_path ,
32- '--source-root' , self .source_root ,
33- '--dump-hashes' ])
30+ # Then dump the hashes.
31+ output = self .call ([self .update_checkout_path ,
32+ '--config' , self .config_path ,
33+ '--source-root' , self .source_root ,
34+ '--dump-hashes' ])
35+ # The output should be valid JSON
36+ result = json .loads (output )
37+
38+ # And it should have some basic properties we expect from this JSON
39+ self .assertIn ("https-clone-pattern" , result )
40+ self .assertEqual (result ["repos" ], scheme_mock .MOCK_CONFIG ["repos" ])
41+ self .assertEqual (result ["ssh-clone-pattern" ], "DO_NOT_USE" )
42+ self .assertSetEqual (set (result ["branch-schemes" ].keys ()), {"repro" })
0 commit comments