Updated the unittests for query_by_example changes

query_by_example is not very useful in its current form as it uses its query for fetching only. If it returned the built query instead i could be used for all methods with a query argument.
The changes to the function are not in as of this commit. This commit updates the tests for the test first approach.