Django 16 db patches fixes

This is a continuation on the pull request #50

It adds tests for the CursorWrapper patching routines.