Skip to content

Commit

Permalink
Add simple if_exists test
Browse files Browse the repository at this point in the history
  • Loading branch information
WillNilges committed Apr 2, 2024
1 parent 1c26b21 commit 6204841
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions dbbackup/tests/test_connectors/test_postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,16 @@ def test_create_dump_drop(self, mock_dump_cmd):
self.connector.create_dump()
self.assertNotIn(" --clean", mock_dump_cmd.call_args[0][0])

def test_create_dump_if_exists(self, mock_dump_cmd):
# Without
self.connector.if_exists = False
self.connector.create_dump()
self.assertNotIn(" --if-exists", mock_dump_cmd.call_args[0][0])
# With
self.connector.if_exists = True
self.connector.create_dump()
self.assertIn(" --if-exists", mock_dump_cmd.call_args[0][0])

@patch(
"dbbackup.db.postgresql.PgDumpBinaryConnector.run_command",
return_value=(BytesIO(), BytesIO()),
Expand Down

0 comments on commit 6204841

Please sign in to comment.