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

Fix invalid/non-representative tests #1064

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions tests/panels/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,11 @@ def test_non_ascii_query(self):
list(User.objects.filter(username='thé'))
self.assertEqual(len(self.panel._queries), 2)

# non-ASCII bytes parameters
list(User.objects.filter(username='café'.encode('utf-8')))
self.assertEqual(len(self.panel._queries), 3)

self.panel.process_response(self.request, self.response)
self.panel.generate_stats(self.request, self.response)

# ensure the panel renders correctly
self.assertIn('café', self.panel.content)
self.assertIn('thé', self.panel.content)

def test_param_conversion(self):
self.assertEqual(len(self.panel._queries), 0)
Expand Down Expand Up @@ -105,7 +101,7 @@ def test_insert_content(self):
Test that the panel only inserts content after generate_stats and
not the process_response.
"""
list(User.objects.filter(username='café'.encode('utf-8')))
list(User.objects.filter(username='café'))
self.panel.process_response(self.request, self.response)
# ensure the panel does not have content yet.
self.assertNotIn('café', self.panel.content)
Expand Down