Skip to content

Commit 8a17565

Browse files
committed
fix the new write test for archive entry digests
1 parent 6f6746b commit 8a17565

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tests/test_entry.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ def test_non_ASCII_encoding_of_file_metadata():
162162
)
163163
mtree = (
164164
'#mtree\n'
165-
'./empty.txt nlink=0 time=0.0 mode=664 gid=0 uid=0 type=file size=0 '
166-
f'md5={'21'*16} rmd160={'21'*20} sha1={'21'*20} sha256={'21'*32} '
167-
f'sha384={'21'*48} sha512={'21'*64}\n'
165+
'./empty.txt nlink=0 time=0.0 mode=664 gid=0 uid=0 type=file size=42 '
166+
f'md5digest={'21'*16} rmd160digest={'21'*20} sha1digest={'21'*20} '
167+
f'sha256digest={'21'*32} sha384digest={'21'*48} sha512digest={'21'*64}\n'
168168
)
169169

170170

@@ -180,9 +180,10 @@ def test_reading_entry_digests(tmpdir):
180180
)
181181
def test_writing_entry_digests(tmpdir):
182182
archive_path = str(tmpdir / 'mtree')
183-
with file_writer(archive_path, 'mtree') as archive:
183+
options = ','.join(fake_hashes.keys())
184+
with file_writer(archive_path, 'mtree', options=options) as archive:
184185
# Add an empty file, with fake hashes.
185-
archive.add_file_from_memory('empty.txt', 0, b'', stored_digests=fake_hashes)
186+
archive.add_file_from_memory('empty.txt', 42, (), stored_digests=fake_hashes)
186187
with open(archive_path) as f:
187188
libarchive_mtree = f.read()
188189
assert libarchive_mtree == mtree

0 commit comments

Comments
 (0)