@@ -52,17 +52,19 @@ class KeyfileTest(TestDirMixin, TestCase):
5252 def test_round_trip (self ):
5353 # encrypt our sample files
5454 enc = self .run_command (self .encryption_flag , self .tiny_sample , self .another_sample )
55+ manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
56+
5557 # ordered lexicographically by filename
5658 self .assertEqual (enc , [
57- f'*** 1/2 : { self .another_sample } ' ,
59+ f'*** 1/3 : { self .another_sample } ' ,
5860 self .another_sample_blobname ,
59- f'*** 2/2: { self .tiny_sample } ' ,
60- self .tiny_sample_blobname
61+ f'*** 2/3: { self .tiny_sample } ' ,
62+ self .tiny_sample_blobname ,
63+ '*** 3/3: {}' .format (path .basename (manifest_name )),
6164 ])
6265 blobs = [l for l in enc if not l .startswith ('***' )]
6366
6467 # check that the manifest looks good
65- manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
6668 show_mfn = self .run_command (self .decryption_flag , '--dump-manifest' , manifest_name )
6769 self .assertEqual (
6870 show_mfn , ['* another_sample.txt:' , blobs [0 ], '* tiny_sample.txt:' , blobs [1 ]]
@@ -167,15 +169,17 @@ def test_absolute_paths(self):
167169 enc = self .run_command (
168170 self .encryption_flag , self .tiny_sample , self .another_sample , '--store-absolute-paths'
169171 )
172+ manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
173+
170174 self .assertEqual (enc , [
171- f'*** 1/2 : { self .another_sample } ' ,
175+ f'*** 1/3 : { self .another_sample } ' ,
172176 self .another_sample_blobname ,
173- f'*** 2/2: { self .tiny_sample } ' ,
174- self .tiny_sample_blobname
177+ f'*** 2/3: { self .tiny_sample } ' ,
178+ self .tiny_sample_blobname ,
179+ '*** 3/3: {}' .format (path .basename (manifest_name )),
175180 ])
176181
177182 # check that the manifest looks good
178- manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
179183 show_mfn = self .run_command (self .decryption_flag , '--dump-manifest' , manifest_name )
180184 self .assertEqual (
181185 show_mfn , [
@@ -211,15 +215,17 @@ def test_glob_input_directory(self):
211215 enc = self .run_command (
212216 self .encryption_flag , self .input_dir .name , '--store-absolute-paths'
213217 )
218+ manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
219+
214220 self .assertEqual (enc , [
215- f'*** 1/2 : { self .another_sample } ' ,
221+ f'*** 1/3 : { self .another_sample } ' ,
216222 self .another_sample_blobname ,
217- f'*** 2/2: { self .tiny_sample } ' ,
218- self .tiny_sample_blobname
223+ f'*** 2/3: { self .tiny_sample } ' ,
224+ self .tiny_sample_blobname ,
225+ '*** 3/3: {}' .format (path .basename (manifest_name )),
219226 ])
220227
221228 # check that the manifest looks good
222- manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
223229 show_mfn = self .run_command (self .decryption_flag , '--dump-manifest' , manifest_name )
224230 self .assertEqual (
225231 show_mfn , [
@@ -245,16 +251,18 @@ def test_manifest_index_ordering(self):
245251 '''
246252 # encrypt our sample files
247253 enc = self .run_command (self .encryption_flag , self .tiny_sample , self .another_sample )
254+ manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
255+
248256 self .assertEqual (enc , [
249- f'*** 1/2 : { self .another_sample } ' ,
257+ f'*** 1/3 : { self .another_sample } ' ,
250258 self .another_sample_blobname ,
251- f'*** 2/2: { self .tiny_sample } ' ,
252- self .tiny_sample_blobname
259+ f'*** 2/3: { self .tiny_sample } ' ,
260+ self .tiny_sample_blobname ,
261+ '*** 3/3: {}' .format (path .basename (manifest_name )),
253262 ])
254263 blobs = [l for l in enc if not l .startswith ('***' )]
255264
256265 # check that the manifest index looks good
257- manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
258266 show_mfn = self .run_command (self .decryption_flag , '--dump-manifest-index' , manifest_name )
259267 # manifest index sorted by blobname
260268 self .assertEqual (show_mfn , sorted (blobs ))
@@ -276,15 +284,17 @@ def tearDownClass(cls):
276284 def test_with_keyfile (self ):
277285 # encrypt our sample file
278286 enc = self .run_command (f'--keyfile={ POG_ROOT } /tests/samples/only_for_testing.encrypt' , BigFileTest .big_sample )
287+ manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
288+
279289 self .assertEqual (enc , [
280- f'*** 1/1 : { self .big_sample } ' ,
290+ f'*** 1/2 : { self .big_sample } ' ,
281291 'xyQWj-UXXZpwWXPF2c5_MsBm3cTfZFXayUVLLMlkt4Y=' ,
282292 'HXBJ_N4EM2rywLdOWT02hccp4c_oLk0QyD2lc3vUttw=' ,
293+ '*** 2/2: {}' .format (path .basename (manifest_name )),
283294 ])
284295 blobs = [l for l in enc if not l .startswith ('***' )]
285296
286297 # check that the manifest looks good
287- manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
288298 show_mfn = self .run_command (f'--keyfile={ POG_ROOT } /tests/samples/only_for_testing.encrypt' , '--dump-manifest' ,
289299 manifest_name )
290300 self .assertEqual (show_mfn , ['* big_sample.bin:' ] + blobs )
@@ -307,15 +317,17 @@ def test_with_asymmetric(self):
307317 # encrypt our sample file
308318 enc = self .run_command (f'--encryption-keyfile={ POG_ROOT } /tests/samples/only_for_testing.encrypt' ,
309319 BigFileTest .big_sample )
320+ manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
321+
310322 self .assertEqual (enc , [
311- f'*** 1/1 : { self .big_sample } ' ,
323+ f'*** 1/2 : { self .big_sample } ' ,
312324 'RiOpsEQbQpxrBvXL1s047hq54EhFXxWqwag-vMuiRfc=' ,
313325 'YdK86P4e2191CxVBhZwvvPtwOLU6Ve1NzMhwLjxVXqg=' ,
326+ '*** 2/2: {}' .format (path .basename (manifest_name )),
314327 ])
315328 blobs = [l for l in enc if not l .startswith ('***' )]
316329
317330 # check that the manifest looks good
318- manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
319331 show_mfn = self .run_command (f'--decryption-keyfile={ POG_ROOT } /tests/samples/only_for_testing.decrypt' ,
320332 '--dump-manifest' , manifest_name )
321333 self .assertEqual (show_mfn , ['* big_sample.bin:' ] + blobs )
@@ -345,16 +357,18 @@ def test_smaller_chunk_size(self):
345357 f'--encryption-keyfile={ POG_ROOT } /tests/samples/only_for_testing.encrypt' , BigFileTest .big_sample ,
346358 '--chunk-size=50MB'
347359 )
360+ manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
361+
348362 self .assertEqual (enc , [
349- f'*** 1/1 : { self .big_sample } ' ,
363+ f'*** 1/2 : { self .big_sample } ' ,
350364 'PURfe1ei1aqpPRarpAfKkcKPRSHdo5hPH-bvfYND2KM=' ,
351365 'nnL4ta-BChpb36CIFeZUG4lJLiz8l0YVv94IaABcgyU=' ,
352366 'YdK86P4e2191CxVBhZwvvPtwOLU6Ve1NzMhwLjxVXqg=' ,
367+ '*** 2/2: {}' .format (path .basename (manifest_name )),
353368 ])
354369 blobs = [l for l in enc if not l .startswith ('***' )]
355370
356371 # check that the manifest looks good
357- manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
358372 show_mfn = self .run_command (f'--decryption-keyfile={ POG_ROOT } /tests/samples/only_for_testing.decrypt' ,
359373 '--dump-manifest' , manifest_name )
360374 self .assertEqual (show_mfn , ['* big_sample.bin:' ] + blobs )
0 commit comments