Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reintroduced inputfile.seek(0) to utils.uncompress_file #503

Merged
merged 5 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions dbbackup/tests/functional/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ def test_compressed(self, *args):
self.instance.delete()
# Restore
execute_from_command_line(["", "dbrestore", "--uncompress"])
restored = models.CharModel.objects.all().exists()
self.assertTrue(restored)

def test_no_backup_available(self, *args):
with self.assertRaises(SystemExit):
Expand Down Expand Up @@ -131,6 +133,16 @@ def test_specify_db(self, *args):
# Restore
execute_from_command_line(["", "dbrestore", "--database", "default"])

@patch("dbbackup.utils.getpass", return_value=None)
def test_compressed_and_encrypted(self, *args):
# Create backup
execute_from_command_line(["", "dbbackup", "--compress", "--encrypt"])
self.instance.delete()
# Restore
execute_from_command_line(["", "dbrestore", "--uncompress", "--decrypt"])
restored = models.CharModel.objects.all().exists()
self.assertTrue(restored)


class MediaBackupCommandTest(TestCase):
def setUp(self):
Expand Down
1 change: 1 addition & 0 deletions dbbackup/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ def uncompress_file(inputfile, filename):
"""
zipfile = gzip.GzipFile(fileobj=inputfile, mode="rb")
try:
inputfile.seek(0)
outputfile = create_spooled_temporary_file(fileobj=zipfile)
finally:
zipfile.close()
Expand Down
6 changes: 6 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

Unreleased
----------

* reintroduced inputfile.seek(0) to utils.uncompress_file `#503`_


4.0.0b0 (2021-12-19)
--------------------

Expand Down
Loading