diff --git a/dbbackup/tests/test_connectors/test_postgresql.py b/dbbackup/tests/test_connectors/test_postgresql.py index f1923ce..5df7add 100644 --- a/dbbackup/tests/test_connectors/test_postgresql.py +++ b/dbbackup/tests/test_connectors/test_postgresql.py @@ -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()),