10
10
#
11
11
# ===----------------------------------------------------------------------===#
12
12
13
+ import json
14
+
13
15
from . import scheme_mock
14
16
15
17
@@ -25,9 +27,16 @@ def test_dump_hashes_json(self):
25
27
'--source-root' , self .source_root ,
26
28
'--clone' ])
27
29
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