Skip to content
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

Merged
merged 12 commits into from
Jul 28, 2014
Merged

Newfeature/query connection #21

merged 12 commits into from
Jul 28, 2014

Conversation

micahhausler
Copy link
Contributor

@wesokes
@wesleykendall

  • Added connection parameter to Query
  • cleaned up documentation
  • flake8 passing

self.assertIsInstance(
Query().from_table('auth_user').count(), int
)

Copy link
Contributor

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.

@somewes
Copy link
Contributor

somewes commented Jul 28, 2014

@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
)

Copy link
Contributor

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.

somewes added a commit that referenced this pull request Jul 28, 2014
@somewes somewes merged commit 52af41d into ambitioninc:develop Jul 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants