diff --git a/dbbackup/tests/test_connectors/test_postgresql.py b/dbbackup/tests/test_connectors/test_postgresql.py index 5df7add..a7b6e54 100644 --- a/dbbackup/tests/test_connectors/test_postgresql.py +++ b/dbbackup/tests/test_connectors/test_postgresql.py @@ -213,15 +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): + def test_create_dump_if_exists(self, mock_dump_cmd, mock_restore_cmd): + dump = self.connector.create_dump() # Without self.connector.if_exists = False - self.connector.create_dump() - self.assertNotIn(" --if-exists", mock_dump_cmd.call_args[0][0]) + self.connector.restore_dump(dump) + self.assertNotIn(" --if-exists", mock_restore_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]) + self.connector.restore_dump(dump) + self.assertIn(" --if-exists", mock_restore_cmd.call_args[0][0]) @patch( "dbbackup.db.postgresql.PgDumpBinaryConnector.run_command",