@@ -52,17 +52,19 @@ class KeyfileTest(TestDirMixin, TestCase):
52
52
def test_round_trip (self ):
53
53
# encrypt our sample files
54
54
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
+
55
57
# ordered lexicographically by filename
56
58
self .assertEqual (enc , [
57
- f'*** 1/2 : { self .another_sample } ' ,
59
+ f'*** 1/3 : { self .another_sample } ' ,
58
60
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 )),
61
64
])
62
65
blobs = [l for l in enc if not l .startswith ('***' )]
63
66
64
67
# check that the manifest looks good
65
- manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
66
68
show_mfn = self .run_command (self .decryption_flag , '--dump-manifest' , manifest_name )
67
69
self .assertEqual (
68
70
show_mfn , ['* another_sample.txt:' , blobs [0 ], '* tiny_sample.txt:' , blobs [1 ]]
@@ -167,15 +169,17 @@ def test_absolute_paths(self):
167
169
enc = self .run_command (
168
170
self .encryption_flag , self .tiny_sample , self .another_sample , '--store-absolute-paths'
169
171
)
172
+ manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
173
+
170
174
self .assertEqual (enc , [
171
- f'*** 1/2 : { self .another_sample } ' ,
175
+ f'*** 1/3 : { self .another_sample } ' ,
172
176
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 )),
175
180
])
176
181
177
182
# check that the manifest looks good
178
- manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
179
183
show_mfn = self .run_command (self .decryption_flag , '--dump-manifest' , manifest_name )
180
184
self .assertEqual (
181
185
show_mfn , [
@@ -211,15 +215,17 @@ def test_glob_input_directory(self):
211
215
enc = self .run_command (
212
216
self .encryption_flag , self .input_dir .name , '--store-absolute-paths'
213
217
)
218
+ manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
219
+
214
220
self .assertEqual (enc , [
215
- f'*** 1/2 : { self .another_sample } ' ,
221
+ f'*** 1/3 : { self .another_sample } ' ,
216
222
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 )),
219
226
])
220
227
221
228
# check that the manifest looks good
222
- manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
223
229
show_mfn = self .run_command (self .decryption_flag , '--dump-manifest' , manifest_name )
224
230
self .assertEqual (
225
231
show_mfn , [
@@ -245,16 +251,18 @@ def test_manifest_index_ordering(self):
245
251
'''
246
252
# encrypt our sample files
247
253
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
+
248
256
self .assertEqual (enc , [
249
- f'*** 1/2 : { self .another_sample } ' ,
257
+ f'*** 1/3 : { self .another_sample } ' ,
250
258
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 )),
253
262
])
254
263
blobs = [l for l in enc if not l .startswith ('***' )]
255
264
256
265
# check that the manifest index looks good
257
- manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
258
266
show_mfn = self .run_command (self .decryption_flag , '--dump-manifest-index' , manifest_name )
259
267
# manifest index sorted by blobname
260
268
self .assertEqual (show_mfn , sorted (blobs ))
@@ -276,15 +284,17 @@ def tearDownClass(cls):
276
284
def test_with_keyfile (self ):
277
285
# encrypt our sample file
278
286
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
+
279
289
self .assertEqual (enc , [
280
- f'*** 1/1 : { self .big_sample } ' ,
290
+ f'*** 1/2 : { self .big_sample } ' ,
281
291
'xyQWj-UXXZpwWXPF2c5_MsBm3cTfZFXayUVLLMlkt4Y=' ,
282
292
'HXBJ_N4EM2rywLdOWT02hccp4c_oLk0QyD2lc3vUttw=' ,
293
+ '*** 2/2: {}' .format (path .basename (manifest_name )),
283
294
])
284
295
blobs = [l for l in enc if not l .startswith ('***' )]
285
296
286
297
# check that the manifest looks good
287
- manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
288
298
show_mfn = self .run_command (f'--keyfile={ POG_ROOT } /tests/samples/only_for_testing.encrypt' , '--dump-manifest' ,
289
299
manifest_name )
290
300
self .assertEqual (show_mfn , ['* big_sample.bin:' ] + blobs )
@@ -307,15 +317,17 @@ def test_with_asymmetric(self):
307
317
# encrypt our sample file
308
318
enc = self .run_command (f'--encryption-keyfile={ POG_ROOT } /tests/samples/only_for_testing.encrypt' ,
309
319
BigFileTest .big_sample )
320
+ manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
321
+
310
322
self .assertEqual (enc , [
311
- f'*** 1/1 : { self .big_sample } ' ,
323
+ f'*** 1/2 : { self .big_sample } ' ,
312
324
'RiOpsEQbQpxrBvXL1s047hq54EhFXxWqwag-vMuiRfc=' ,
313
325
'YdK86P4e2191CxVBhZwvvPtwOLU6Ve1NzMhwLjxVXqg=' ,
326
+ '*** 2/2: {}' .format (path .basename (manifest_name )),
314
327
])
315
328
blobs = [l for l in enc if not l .startswith ('***' )]
316
329
317
330
# check that the manifest looks good
318
- manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
319
331
show_mfn = self .run_command (f'--decryption-keyfile={ POG_ROOT } /tests/samples/only_for_testing.decrypt' ,
320
332
'--dump-manifest' , manifest_name )
321
333
self .assertEqual (show_mfn , ['* big_sample.bin:' ] + blobs )
@@ -345,16 +357,18 @@ def test_smaller_chunk_size(self):
345
357
f'--encryption-keyfile={ POG_ROOT } /tests/samples/only_for_testing.encrypt' , BigFileTest .big_sample ,
346
358
'--chunk-size=50MB'
347
359
)
360
+ manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
361
+
348
362
self .assertEqual (enc , [
349
- f'*** 1/1 : { self .big_sample } ' ,
363
+ f'*** 1/2 : { self .big_sample } ' ,
350
364
'PURfe1ei1aqpPRarpAfKkcKPRSHdo5hPH-bvfYND2KM=' ,
351
365
'nnL4ta-BChpb36CIFeZUG4lJLiz8l0YVv94IaABcgyU=' ,
352
366
'YdK86P4e2191CxVBhZwvvPtwOLU6Ve1NzMhwLjxVXqg=' ,
367
+ '*** 2/2: {}' .format (path .basename (manifest_name )),
353
368
])
354
369
blobs = [l for l in enc if not l .startswith ('***' )]
355
370
356
371
# check that the manifest looks good
357
- manifest_name = glob (path .join (self .working_dir .name , '*.mfn' ))[0 ]
358
372
show_mfn = self .run_command (f'--decryption-keyfile={ POG_ROOT } /tests/samples/only_for_testing.decrypt' ,
359
373
'--dump-manifest' , manifest_name )
360
374
self .assertEqual (show_mfn , ['* big_sample.bin:' ] + blobs )
0 commit comments