@@ -6,12 +6,10 @@ mod csp_generator_test {
66 #[ test]
77 fn test_enforce ( ) {
88 let json = r#"
9- {
10- "domains": [
11- {"domain": "example.com", "directive": ["connect-src"]},
12- {"domain": "test.com", "directive": ["connect-src", "script-src"]}
13- ]
14- }
9+ [
10+ {"domain": "example.com", "directive": ["connect-src"]},
11+ {"domain": "test.com", "directive": ["connect-src", "script-src"]}
12+ ]
1513 "# ;
1614
1715 let csp: csp_generator:: Csp = csp_generator:: enforce ( config:: get_directives ( ) , json) ;
@@ -35,12 +33,10 @@ mod csp_generator_test {
3533 #[ should_panic( expected = "Could not parse JSON: missing field" ) ]
3634 fn test_enforce_format_fail ( ) {
3735 let json = r#"
38- {
39- "domains": [
40- {"domain": "example.com", "diroctive": ["connect-src"]},
41- {"domain": "test.com", "directive": ["connect-src", "script-src"]}
42- ]
43- }
36+ [
37+ {"domain": "example.com", "diroctive": ["connect-src"]},
38+ {"domain": "test.com", "directive": ["connect-src", "script-src"]}
39+ ]
4440 "# ;
4541
4642 csp_generator:: enforce ( config:: get_directives ( ) , json) ;
@@ -49,12 +45,10 @@ mod csp_generator_test {
4945 #[ test]
5046 fn test_report_only ( ) {
5147 let json = r#"
52- {
53- "domains": [
54- {"domain": "example.com", "directive": ["connect-src"]},
55- {"domain": "test.com", "directive": ["connect-src", "script-src"]}
56- ]
57- }
48+ [
49+ {"domain": "example.com", "directive": ["connect-src"]},
50+ {"domain": "test.com", "directive": ["connect-src", "script-src"]}
51+ ]
5852 "# ;
5953
6054 let csp: csp_generator:: Csp = csp_generator:: report_only ( config:: get_directives ( ) , json) ;
@@ -81,12 +75,10 @@ mod csp_generator_test {
8175 #[ should_panic( expected = "Could not parse JSON: missing field" ) ]
8276 fn test_report_only_format_fail ( ) {
8377 let json = r#"
84- {
85- "domains": [
86- {"domain": "example.com", "directive": ["connect-src"]},
87- {"directive": ["connect-src", "script-src"]}
88- ]
89- }
78+ [
79+ {"domain": "example.com", "directive": ["connect-src"]},
80+ {"directive": ["connect-src", "script-src"]}
81+ ]
9082 "# ;
9183
9284 csp_generator:: report_only ( config:: get_directives ( ) , json) ;
@@ -95,12 +87,10 @@ mod csp_generator_test {
9587 #[ test]
9688 fn test_csp_only ( ) {
9789 let json = r#"
98- {
99- "domains": [
100- {"domain": "example.com", "directive": ["connect-src"]},
101- {"domain": "test.com", "directive": ["connect-src", "script-src"]}
102- ]
103- }
90+ [
91+ {"domain": "example.com", "directive": ["connect-src"]},
92+ {"domain": "test.com", "directive": ["connect-src", "script-src"]}
93+ ]
10494 "# ;
10595
10696 let csp: String = csp_generator:: csp_only ( config:: get_directives ( ) , json) ;
0 commit comments