mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-06-02 21:39:23 +00:00
688978369f
Co-authored-by: Daniel Burgess <developerdannymate@gmail.com> Co-authored-by: Hugh Rundle <hugh@hughrundle.net> Co-authored-by: dannymate <dannymate@noreply.codeberg.org> Co-authored-by: hughrun <hughrun@noreply.codeberg.org> Reviewed-on: https://codeberg.org/GuildAlpha/bookwyrm/pulls/38 Co-authored-by: CSDUMMI <csdummi.misquality@simplelogin.co> Co-committed-by: CSDUMMI <csdummi.misquality@simplelogin.co>
24 lines
642 B
Python
24 lines
642 B
Python
from bookwyrm.utils.tar import BookwyrmTarFile
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture
|
|
def read_tar():
|
|
archive_path = "../data/bookwyrm_account_export.tar.gz"
|
|
with open(archive_path, "rb") as archive_file:
|
|
with BookwyrmTarFile.open(mode="r:gz", fileobj=archive_file) as tar:
|
|
yield tar
|
|
|
|
|
|
def get_write_tar():
|
|
archive_path = "/tmp/test.tar.gz"
|
|
with open(archive_path, "wb") as archive_file:
|
|
with BookwyrmTarFile.open(mode="w:gz", fileobj=archive_file) as tar:
|
|
return tar
|
|
|
|
os.remove(archive_path)
|
|
|
|
|
|
def test_write_bytes(write_tar):
|
|
write_tar.write_bytes(b"ABCDEF", filename="example.txt")
|