Adds tests to sqlachemy.api._retry_on_deadlock

This methods needs tests.

Change-Id: I908daf9e280e25c2ad535bca96b558c19c507e4c
Merge "Adds tests to sqlachemy.api._retry_on_deadlock"