Let’s back up here… if your DVD drive is having problems how about telling what is happening or not happening.
As to your direct question the optical drive is replaceable which if it’s bad. Finding a case to hold it externally shouldn’t be needed if you are just testing it. This is all you need crwdns2937315:0IF107-120crwdne2937315:0
Many people take out the optical drive so they can add in a second drive HDD or SSD. Here’s the needed carrier to do that iMac & Mac mini Dual Drive Enclosure
crwdns2934105:0crwdne2934105:0
crwdns2934113:0crwdne2934113:0
crwdns2915270:0crwdne2915270:0
crwdns2889612:0crwdne2889612:0
1