-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Newfeature/query connection #21
Newfeature/query connection #21
Conversation
self.assertIsInstance( | ||
Query().from_table('auth_user').count(), int | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than running an actual query on these, you could add a method to Query called get_cursor that just returns self.connection.cursor. Be sure to update each self.connection.cursor reference to use self.get_cursor() Then your tests could simply verify that the cursor references contain the correct db reference. Each .cursor() call is going to be a different object, but the .db property should reference the same db object for that connection.
@micahhausler Nice update! I had one comment about testing the different db cursors, but everything else looks great. |
self.assertIn( | ||
type(Query().from_table('auth_user').count()), six.integer_types | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@micahhausler My comment got knocked out from a change you made to the type checking, so I'll just paste it on here.
Rather than running an actual query on these, you could add a method to Query called get_cursor that just returns self.connection.cursor. Be sure to update each self.connection.cursor reference to use self.get_cursor() Then your tests could simply verify that the cursor references contain the correct db reference. Each .cursor() call is going to be a different object, but the .db property should reference the same db object for that connection.
@wesokes
@wesleykendall