1
- import sys
2
1
import json
3
2
import os
4
3
11
10
html_manifest_json_file = os .path .join (cur_dir , "testdata" , "Manifest" , "html_manifest.json" )
12
11
13
12
14
- @pytest .mark .skipif (sys .platform in ("win32" , "win64" ), reason = "Backslash vs forward slash" )
15
13
def test_Manifest_from_json ():
16
14
html_manifest_dict = {
17
15
"version" : 1 ,
@@ -27,31 +25,13 @@ def test_Manifest_from_json():
27
25
assert m .json == manifest_json_str
28
26
29
27
30
- @pytest .mark .skipif (sys .platform not in ("win32" , "win64" ), reason = "Backslash vs forward slash" )
31
- def test_Manifest_from_json_Windows ():
32
- html_manifest_dict = {
33
- "version" : 1 ,
34
- "metadata" : {"appmode" : "static" , "primary_html" : "index.html" , "entrypoint" : "index.html" },
35
- "files" : {
36
- "index.html" : {"checksum" : "c14bd63e50295f94b761ffe9d41e3742" },
37
- "test1.txt" : {"checksum" : "3e7705498e8be60520841409ebc69bc1" },
38
- "test_folder1\\ testfoldertext1.txt" : {"checksum" : "0a576fd324b6985bac6aa934131d2f5c" },
39
- },
40
- }
41
- manifest_json_str = json .dumps (html_manifest_dict , indent = 2 )
42
- m = Manifest .from_json (manifest_json_str )
43
- assert m .json == manifest_json_str
44
-
45
-
46
- @pytest .mark .skipif (sys .platform in ("win32" , "win64" ), reason = "Backslash vs forward slash" )
47
28
def test_Manifest_from_json_file ():
48
29
m = Manifest .from_json_file (html_manifest_json_file )
49
30
with open (html_manifest_json_file ) as json_file :
50
31
json_dict = json .load (json_file )
51
32
assert m .json == json .dumps (json_dict , indent = 2 )
52
33
53
34
54
- @pytest .mark .skipif (sys .platform in ("win32" , "win64" ), reason = "Backslash vs forward slash" )
55
35
def test_Manifest_properties ():
56
36
html_manifest_dict = {
57
37
"version" : 1 ,
@@ -71,27 +51,6 @@ def test_Manifest_properties():
71
51
assert list (m .data ["files" ].keys ()) == ["index.html" , "test1.txt" ]
72
52
73
53
74
- @pytest .mark .skipif (sys .platform not in ("win32" , "win64" ), reason = "Backslash vs forward slash" )
75
- def test_Manifest_properties_Windows ():
76
- html_manifest_dict = {
77
- "version" : 1 ,
78
- "metadata" : {"appmode" : "static" , "primary_html" : "index.html" , "entrypoint" : "index.html" },
79
- "files" : {
80
- "index.html" : {"checksum" : "c14bd63e50295f94b761ffe9d41e3742" },
81
- "test1.txt" : {"checksum" : "3e7705498e8be60520841409ebc69bc1" },
82
- "test_folder1\\ testfoldertext1.txt" : {"checksum" : "0a576fd324b6985bac6aa934131d2f5c" },
83
- },
84
- }
85
- manifest_json_str = json .dumps (html_manifest_dict , indent = 2 )
86
- m = Manifest .from_json (manifest_json_str )
87
- assert m .primary_html == html_manifest_dict ["metadata" ]["primary_html" ]
88
- assert m .entrypoint == html_manifest_dict ["metadata" ]["entrypoint" ]
89
-
90
- m .discard_file ("test_folder1\\ testfoldertext1.txt" )
91
- assert list (m .data ["files" ].keys ()) == ["index.html" , "test1.txt" ]
92
-
93
-
94
- @pytest .mark .skipif (sys .platform in ("win32" , "win64" ), reason = "Backslash vs forward slash" )
95
54
def test_Manifest_flattened_copy ():
96
55
start = {
97
56
"version" : 1 ,
@@ -125,44 +84,6 @@ def test_Manifest_flattened_copy():
125
84
assert m .flattened_copy .data == html_manifest_dict
126
85
127
86
128
- @pytest .mark .skipif (sys .platform not in ("win32" , "win64" ), reason = "Backslash vs forward slash" )
129
- def test_Manifest_flattened_copy_Windows ():
130
- start = {
131
- "version" : 1 ,
132
- "metadata" : {
133
- "appmode" : "static" ,
134
- "primary_html" : "tests\\ testdata\\ html_tests\\ single_file_index\\ index.html" ,
135
- "entrypoint" : "tests\\ testdata\\ html_tests\\ single_file_index\\ index.html" ,
136
- },
137
- "files" : {
138
- "tests\\ testdata\\ html_tests\\ single_file_index\\ index.html" : {
139
- "checksum" : "c14bd63e50295f94b761ffe9d41e3742"
140
- },
141
- "tests\\ testdata\\ html_tests\\ single_file_index\\ test1.txt" : {
142
- "checksum" : "3e7705498e8be60520841409ebc69bc1"
143
- },
144
- "tests\\ testdata\\ html_tests\\ single_file_index\\ test_folder1\\ testfoldertext1.txt" : {
145
- "checksum" : "0a576fd324b6985bac6aa934131d2f5c"
146
- },
147
- },
148
- }
149
- start_json_str = json .dumps (start , indent = 2 )
150
- m = Manifest .from_json (start_json_str )
151
- assert m .data == start
152
- m .entrypoint = "tests\\ testdata\\ html_tests\\ single_file_index\\ index.html"
153
- m .deploy_dir = "tests\\ testdata\\ html_tests\\ single_file_index"
154
- html_manifest_dict = {
155
- "version" : 1 ,
156
- "metadata" : {"appmode" : "static" , "primary_html" : "index.html" , "entrypoint" : "index.html" },
157
- "files" : {
158
- "index.html" : {"checksum" : "c14bd63e50295f94b761ffe9d41e3742" },
159
- "test1.txt" : {"checksum" : "3e7705498e8be60520841409ebc69bc1" },
160
- "test_folder1\\ testfoldertext1.txt" : {"checksum" : "0a576fd324b6985bac6aa934131d2f5c" },
161
- },
162
- }
163
- assert m .flattened_copy .data == html_manifest_dict
164
-
165
-
166
87
def test_Manifest_empty_init ():
167
88
init = {
168
89
"version" : 1 ,
0 commit comments