Commit 68618ee 1 parent b4680b8 commit 68618ee Copy full SHA for 68618ee
File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ import json
2
+ import sys
3
+
4
+ if len (sys .argv ) < 2 :
5
+ print (f'Usage: $ python { sys .argv [0 ]} YOUR_JSON_OUTPUT_FILE' )
6
+ sys .exit (1 )
7
+
8
+ json_output_file = sys .argv [1 ]
9
+
10
+ with open (json_output_file ) as f :
11
+ resp = json .loads (f .read ())
12
+
13
+ for attr in 'github_repo tasks title version' .split ():
14
+ assert attr in resp , f'Attribute { attr } not in JSON output'
15
+
16
+ assert len (resp ['tasks' ]) == 100 , 'Not 100 tasks in JSON output'
17
+
18
+ first_task = resp ['tasks' ][0 ]
19
+ last_task = resp ['tasks' ][- 1 ]
20
+ for attr in 'day activity done' .split ():
21
+ assert attr in first_task , f'Attribute { attr } not in first task dict'
22
+ assert attr in last_task , f'Attribute { attr } not in last task dict'
23
+
24
+ print ('JSON validation done, all good' )
You can’t perform that action at this time.
0 commit comments