1- import sys
21import json
32import os
43
1110html_manifest_json_file = os .path .join (cur_dir , "testdata" , "Manifest" , "html_manifest.json" )
1211
1312
14- @pytest .mark .skipif (sys .platform in ("win32" , "win64" ), reason = "Backslash vs forward slash" )
1513def test_Manifest_from_json ():
1614 html_manifest_dict = {
1715 "version" : 1 ,
@@ -27,31 +25,13 @@ def test_Manifest_from_json():
2725 assert m .json == manifest_json_str
2826
2927
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" )
4728def test_Manifest_from_json_file ():
4829 m = Manifest .from_json_file (html_manifest_json_file )
4930 with open (html_manifest_json_file ) as json_file :
5031 json_dict = json .load (json_file )
5132 assert m .json == json .dumps (json_dict , indent = 2 )
5233
5334
54- @pytest .mark .skipif (sys .platform in ("win32" , "win64" ), reason = "Backslash vs forward slash" )
5535def test_Manifest_properties ():
5636 html_manifest_dict = {
5737 "version" : 1 ,
@@ -71,27 +51,6 @@ def test_Manifest_properties():
7151 assert list (m .data ["files" ].keys ()) == ["index.html" , "test1.txt" ]
7252
7353
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" )
9554def test_Manifest_flattened_copy ():
9655 start = {
9756 "version" : 1 ,
@@ -125,44 +84,6 @@ def test_Manifest_flattened_copy():
12584 assert m .flattened_copy .data == html_manifest_dict
12685
12786
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-
16687def test_Manifest_empty_init ():
16788 init = {
16889 "version" : 1 ,
0 commit comments