Commit eef964f5 by Ned Batchelder

Fix unused-variable errors

parent 8aae7bce
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
from lettuce import world, step from lettuce import world, step
from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.keys import Keys
from common import type_in_codemirror from cms.djangoapps.contentstore.features.common import type_in_codemirror
from django.conf import settings from django.conf import settings
from nose.tools import assert_true, assert_false from nose.tools import assert_true, assert_false
......
...@@ -73,7 +73,7 @@ def change_date(_step, new_date): ...@@ -73,7 +73,7 @@ def change_date(_step, new_date):
world.css_click(button_css) world.css_click(button_css)
date_css = 'input.date' date_css = 'input.date'
date = world.css_find(date_css) date = world.css_find(date_css)
for i in range(len(date.value)): for __ in range(len(date.value)):
date._element.send_keys(Keys.END, Keys.BACK_SPACE) date._element.send_keys(Keys.END, Keys.BACK_SPACE)
date._element.send_keys(new_date) date._element.send_keys(new_date)
save_css = '.save-button' save_css = '.save-button'
......
...@@ -19,7 +19,7 @@ def view_grading_settings(step): ...@@ -19,7 +19,7 @@ def view_grading_settings(step):
@step(u'I add "([^"]*)" new grade') @step(u'I add "([^"]*)" new grade')
def add_grade(step, many): def add_grade(step, many):
grade_css = '.new-grade-button' grade_css = '.new-grade-button'
for i in range(int(many)): for __ in range(int(many)):
world.css_click(grade_css) world.css_click(grade_css)
...@@ -120,7 +120,7 @@ def set_weight(step, weight): ...@@ -120,7 +120,7 @@ def set_weight(step, weight):
weight_id = '#course-grading-assignment-gradeweight' weight_id = '#course-grading-assignment-gradeweight'
weight_field = world.css_find(weight_id)[-1] weight_field = world.css_find(weight_id)[-1]
old_weight = world.css_value(weight_id, -1) old_weight = world.css_value(weight_id, -1)
for count in range(len(old_weight)): for __ in range(len(old_weight)):
weight_field._element.send_keys(Keys.END, Keys.BACK_SPACE) weight_field._element.send_keys(Keys.END, Keys.BACK_SPACE)
weight_field._element.send_keys(weight) weight_field._element.send_keys(weight)
......
...@@ -152,7 +152,7 @@ class EnrollmentTest(EnrollmentTestMixin, ModuleStoreTestCase, APITestCase): ...@@ -152,7 +152,7 @@ class EnrollmentTest(EnrollmentTestMixin, ModuleStoreTestCase, APITestCase):
self.rate_limit_config.save() self.rate_limit_config.save()
throttle = EnrollmentUserThrottle() throttle = EnrollmentUserThrottle()
self.rate_limit, rate_duration = throttle.parse_rate(throttle.rate) self.rate_limit, __ = throttle.parse_rate(throttle.rate)
# Pass emit_signals when creating the course so it would be cached # Pass emit_signals when creating the course so it would be cached
# as a CourseOverview. # as a CourseOverview.
...@@ -543,7 +543,7 @@ class EnrollmentTest(EnrollmentTestMixin, ModuleStoreTestCase, APITestCase): ...@@ -543,7 +543,7 @@ class EnrollmentTest(EnrollmentTestMixin, ModuleStoreTestCase, APITestCase):
mode_display_name=CourseMode.DEFAULT_MODE_SLUG, mode_display_name=CourseMode.DEFAULT_MODE_SLUG,
) )
for attempt in xrange(self.rate_limit + 10): for __ in xrange(self.rate_limit + 10):
self.assert_enrollment_status(as_server=True) self.assert_enrollment_status(as_server=True)
def test_create_enrollment_with_mode(self): def test_create_enrollment_with_mode(self):
......
...@@ -30,7 +30,7 @@ def make_random_form(): ...@@ -30,7 +30,7 @@ def make_random_form():
def create(num, course_key): def create(num, course_key):
"""Create num users, enrolling them in course_key if it's not None""" """Create num users, enrolling them in course_key if it's not None"""
for idx in range(num): for __ in range(num):
(user, _, _) = _do_create_account(make_random_form()) (user, _, _) = _do_create_account(make_random_form())
if course_key is not None: if course_key is not None:
CourseEnrollment.enroll(user, course_key) CourseEnrollment.enroll(user, course_key)
......
...@@ -113,7 +113,7 @@ class Command(BaseCommand): ...@@ -113,7 +113,7 @@ class Command(BaseCommand):
diff = datetime.datetime.now() - start diff = datetime.datetime.now() - start
timeleft = diff * (total - count) / STATUS_INTERVAL timeleft = diff * (total - count) / STATUS_INTERVAL
hours, remainder = divmod(timeleft.seconds, 3600) hours, remainder = divmod(timeleft.seconds, 3600)
minutes, seconds = divmod(remainder, 60) minutes, __ = divmod(remainder, 60)
print "{0}/{1} completed ~{2:02}:{3:02}m remaining".format( print "{0}/{1} completed ~{2:02}:{3:02}m remaining".format(
count, total, hours, minutes) count, total, hours, minutes)
start = datetime.datetime.now() start = datetime.datetime.now()
......
...@@ -601,7 +601,7 @@ class TestCreateCommentsServiceUser(TransactionTestCase): ...@@ -601,7 +601,7 @@ class TestCreateCommentsServiceUser(TransactionTestCase):
def test_cs_user_not_created(self, register, request): def test_cs_user_not_created(self, register, request):
"If user account creation fails, we should not create a comments service user" "If user account creation fails, we should not create a comments service user"
try: try:
response = self.client.post(self.url, self.params) self.client.post(self.url, self.params)
except: except:
pass pass
with self.assertRaises(User.DoesNotExist): with self.assertRaises(User.DoesNotExist):
......
...@@ -40,7 +40,7 @@ class TestRecentEnrollments(ModuleStoreTestCase, XssTestMixin): ...@@ -40,7 +40,7 @@ class TestRecentEnrollments(ModuleStoreTestCase, XssTestMixin):
# Old Course # Old Course
old_course_location = locator.CourseLocator('Org0', 'Course0', 'Run0') old_course_location = locator.CourseLocator('Org0', 'Course0', 'Run0')
course, enrollment = self._create_course_and_enrollment(old_course_location) __, enrollment = self._create_course_and_enrollment(old_course_location)
enrollment.created = datetime.datetime(1900, 12, 31, 0, 0, 0, 0) enrollment.created = datetime.datetime(1900, 12, 31, 0, 0, 0, 0)
enrollment.save() enrollment.save()
......
...@@ -106,7 +106,7 @@ class StubCommentsServiceHandler(StubHttpRequestHandler): ...@@ -106,7 +106,7 @@ class StubCommentsServiceHandler(StubHttpRequestHandler):
def do_threads(self): def do_threads(self):
threads = self.server.config.get('threads', {}) threads = self.server.config.get('threads', {})
threads_data = [val for key, val in threads.items()] threads_data = threads.values()
self.send_json_response({"collection": threads_data, "page": 1, "num_pages": 1}) self.send_json_response({"collection": threads_data, "page": 1, "num_pages": 1})
def do_search_threads(self): def do_search_threads(self):
......
...@@ -194,7 +194,7 @@ class GenerateIntIdTestCase(TestCase): ...@@ -194,7 +194,7 @@ class GenerateIntIdTestCase(TestCase):
""" """
minimum = 1 minimum = 1
maximum = times maximum = times
for i in range(times): for __ in range(times):
self.assertIn(generate_int_id(minimum, maximum), range(minimum, maximum + 1)) self.assertIn(generate_int_id(minimum, maximum), range(minimum, maximum + 1))
@ddt.data(10) @ddt.data(10)
...@@ -206,7 +206,7 @@ class GenerateIntIdTestCase(TestCase): ...@@ -206,7 +206,7 @@ class GenerateIntIdTestCase(TestCase):
minimum = 1 minimum = 1
maximum = times maximum = times
used_ids = {2, 4, 6, 8} used_ids = {2, 4, 6, 8}
for i in range(times): for __ in range(times):
int_id = generate_int_id(minimum, maximum, used_ids) int_id = generate_int_id(minimum, maximum, used_ids)
self.assertIn(int_id, list(set(range(minimum, maximum + 1)) - used_ids)) self.assertIn(int_id, list(set(range(minimum, maximum + 1)) - used_ids))
......
...@@ -1289,7 +1289,7 @@ class FormulaEquationInput(InputTypeBase): ...@@ -1289,7 +1289,7 @@ class FormulaEquationInput(InputTypeBase):
# At some point, we might want to mark invalid variables as red # At some point, we might want to mark invalid variables as red
# or something, and this is where we would need to pass those in. # or something, and this is where we would need to pass those in.
result['preview'] = latex_preview(formula) result['preview'] = latex_preview(formula)
except pyparsing.ParseException as err: except pyparsing.ParseException:
result['error'] = _("Sorry, couldn't parse formula") result['error'] = _("Sorry, couldn't parse formula")
result['formula'] = formula result['formula'] = formula
except Exception: except Exception:
......
...@@ -515,7 +515,6 @@ class FormulaResponseXMLFactory(ResponseXMLFactory): ...@@ -515,7 +515,6 @@ class FormulaResponseXMLFactory(ResponseXMLFactory):
# "x,y,z@4,5,3:10,12,8#4" means plug in values for (x,y,z) # "x,y,z@4,5,3:10,12,8#4" means plug in values for (x,y,z)
# from within the box defined by points (4,5,3) and (10,12,8) # from within the box defined by points (4,5,3) and (10,12,8)
# The "#4" means to repeat 4 times. # The "#4" means to repeat 4 times.
variables = [str(v) for v in sample_dict.keys()]
low_range_vals = [str(f[0]) for f in sample_dict.values()] low_range_vals = [str(f[0]) for f in sample_dict.values()]
high_range_vals = [str(f[1]) for f in sample_dict.values()] high_range_vals = [str(f[1]) for f in sample_dict.values()]
sample_str = ( sample_str = (
......
...@@ -358,7 +358,6 @@ class CodeInputTest(unittest.TestCase): ...@@ -358,7 +358,6 @@ class CodeInputTest(unittest.TestCase):
element = etree.fromstring(xml_str) element = etree.fromstring(xml_str)
escapedict = {'"': '"'} escapedict = {'"': '"'}
esc = lambda s: saxutils.escape(s, escapedict)
state = {'value': 'print "good evening"', state = {'value': 'print "good evening"',
'status': 'incomplete', 'status': 'incomplete',
......
...@@ -108,7 +108,7 @@ class CapaModule(CapaMixin, XModule): ...@@ -108,7 +108,7 @@ class CapaModule(CapaMixin, XModule):
_, _, traceback_obj = sys.exc_info() # pylint: disable=redefined-outer-name _, _, traceback_obj = sys.exc_info() # pylint: disable=redefined-outer-name
raise ProcessingError(not_found_error_message), None, traceback_obj raise ProcessingError(not_found_error_message), None, traceback_obj
except Exception as err: except Exception:
log.exception( log.exception(
"Unknown error when dispatching %s to %s for user %s", "Unknown error when dispatching %s to %s for user %s",
dispatch, dispatch,
......
...@@ -10,6 +10,6 @@ def check_html(html): ...@@ -10,6 +10,6 @@ def check_html(html):
try: try:
etree.fromstring(html, parser) etree.fromstring(html, parser)
return True return True
except Exception as err: except Exception: # pylint: disable=broad-except
pass pass
return False return False
...@@ -422,7 +422,7 @@ class TestBulkWriteMixinFindMethods(TestBulkWriteMixin): ...@@ -422,7 +422,7 @@ class TestBulkWriteMixinFindMethods(TestBulkWriteMixin):
db_definitions = [db_definition(_id) for _id in db_ids if _id not in active_ids] db_definitions = [db_definition(_id) for _id in db_ids if _id not in active_ids]
self.bulk._begin_bulk_operation(self.course_key) self.bulk._begin_bulk_operation(self.course_key)
for n, _id in enumerate(active_ids): for _id in active_ids:
self.bulk.update_definition(self.course_key, active_definition(_id)) self.bulk.update_definition(self.course_key, active_definition(_id))
self.conn.get_definitions.return_value = db_definitions self.conn.get_definitions.return_value = db_definitions
......
...@@ -1479,7 +1479,7 @@ class CapaModuleTest(unittest.TestCase): ...@@ -1479,7 +1479,7 @@ class CapaModuleTest(unittest.TestCase):
of the form test_func() -> bool of the form test_func() -> bool
''' '''
success = False success = False
for i in range(num_tries): for __ in range(num_tries):
if test_func() is True: if test_func() is True:
success = True success = True
break break
......
...@@ -1072,14 +1072,14 @@ class DiscussionUserProfileTest(UniqueCourseTest): ...@@ -1072,14 +1072,14 @@ class DiscussionUserProfileTest(UniqueCourseTest):
self.assertFalse(page.is_next_button_shown()) self.assertFalse(page.is_next_button_shown())
# click all the way up through each page # click all the way up through each page
for i in range(current_page, total_pages): for __ in range(current_page, total_pages):
_check_page() _check_page()
if current_page < total_pages: if current_page < total_pages:
page.click_on_page(current_page + 1) page.click_on_page(current_page + 1)
current_page += 1 current_page += 1
# click all the way back down # click all the way back down
for i in range(current_page, 0, -1): for __ in range(current_page, 0, -1):
_check_page() _check_page()
if current_page > 1: if current_page > 1:
page.click_on_page(current_page - 1) page.click_on_page(current_page - 1)
......
...@@ -209,7 +209,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest): ...@@ -209,7 +209,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest):
When I go to my profile page. When I go to my profile page.
Then I see that the profile visibility is set to public. Then I see that the profile visibility is set to public.
""" """
username, user_id = self.log_in_as_unique_user() username, __ = self.log_in_as_unique_user()
profile_page = self.visit_profile_page(username) profile_page = self.visit_profile_page(username)
self.verify_profile_page_is_public(profile_page) self.verify_profile_page_is_public(profile_page)
...@@ -277,7 +277,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest): ...@@ -277,7 +277,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest):
When I click on Profile link. When I click on Profile link.
Then I will be navigated to Profile page. Then I will be navigated to Profile page.
""" """
username, user_id = self.log_in_as_unique_user() username, __ = self.log_in_as_unique_user()
dashboard_page = DashboardPage(self.browser) dashboard_page = DashboardPage(self.browser)
dashboard_page.visit() dashboard_page.visit()
dashboard_page.click_username_dropdown() dashboard_page.click_username_dropdown()
...@@ -362,7 +362,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest): ...@@ -362,7 +362,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest):
Then `country` field mode should be `edit` Then `country` field mode should be `edit`
And `country` field icon should be visible. And `country` field icon should be visible.
""" """
username, user_id = self.log_in_as_unique_user() username, __ = self.log_in_as_unique_user()
profile_page = self.visit_profile_page(username, privacy=self.PRIVACY_PUBLIC) profile_page = self.visit_profile_page(username, privacy=self.PRIVACY_PUBLIC)
self._test_dropdown_field(profile_page, 'country', 'Pakistan', 'Pakistan', 'display') self._test_dropdown_field(profile_page, 'country', 'Pakistan', 'Pakistan', 'display')
...@@ -390,7 +390,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest): ...@@ -390,7 +390,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest):
Then `language` field mode should be `edit` Then `language` field mode should be `edit`
And `language` field icon should be visible. And `language` field icon should be visible.
""" """
username, user_id = self.log_in_as_unique_user() username, __ = self.log_in_as_unique_user()
profile_page = self.visit_profile_page(username, privacy=self.PRIVACY_PUBLIC) profile_page = self.visit_profile_page(username, privacy=self.PRIVACY_PUBLIC)
self._test_dropdown_field(profile_page, 'language_proficiencies', 'Urdu', 'Urdu', 'display') self._test_dropdown_field(profile_page, 'language_proficiencies', 'Urdu', 'Urdu', 'display')
self._test_dropdown_field(profile_page, 'language_proficiencies', '', 'Add language', 'placeholder') self._test_dropdown_field(profile_page, 'language_proficiencies', '', 'Add language', 'placeholder')
...@@ -427,7 +427,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest): ...@@ -427,7 +427,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest):
"why you're taking courses, or what you hope to learn." "why you're taking courses, or what you hope to learn."
) )
username, user_id = self.log_in_as_unique_user() username, __ = self.log_in_as_unique_user()
profile_page = self.visit_profile_page(username, privacy=self.PRIVACY_PUBLIC) profile_page = self.visit_profile_page(username, privacy=self.PRIVACY_PUBLIC)
self._test_textarea_field(profile_page, 'bio', 'ThisIsIt', 'ThisIsIt', 'display') self._test_textarea_field(profile_page, 'bio', 'ThisIsIt', 'ThisIsIt', 'display')
self._test_textarea_field(profile_page, 'bio', '', placeholder_value, 'placeholder') self._test_textarea_field(profile_page, 'bio', '', placeholder_value, 'placeholder')
...@@ -478,7 +478,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest): ...@@ -478,7 +478,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest):
And i cannot upload/remove the image. And i cannot upload/remove the image.
""" """
year_of_birth = datetime.now().year - 5 year_of_birth = datetime.now().year - 5
username, user_id = self.log_in_as_unique_user() username, __ = self.log_in_as_unique_user()
profile_page = self.visit_profile_page(username, privacy=self.PRIVACY_PRIVATE) profile_page = self.visit_profile_page(username, privacy=self.PRIVACY_PRIVATE)
self.verify_profile_forced_private_message( self.verify_profile_forced_private_message(
...@@ -499,7 +499,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest): ...@@ -499,7 +499,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest):
Then i can see the upload/remove image text Then i can see the upload/remove image text
And i am able to upload new image And i am able to upload new image
""" """
username, user_id = self.log_in_as_unique_user() username, __ = self.log_in_as_unique_user()
profile_page = self.visit_profile_page(username, privacy=self.PRIVACY_PUBLIC) profile_page = self.visit_profile_page(username, privacy=self.PRIVACY_PUBLIC)
self.assert_default_image_has_public_access(profile_page) self.assert_default_image_has_public_access(profile_page)
...@@ -664,7 +664,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest): ...@@ -664,7 +664,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest):
Then i can see only the upload image text Then i can see only the upload image text
And i cannot see the remove image text And i cannot see the remove image text
""" """
username, user_id = self.log_in_as_unique_user() username, __ = self.log_in_as_unique_user()
profile_page = self.visit_profile_page(username, privacy=self.PRIVACY_PUBLIC) profile_page = self.visit_profile_page(username, privacy=self.PRIVACY_PUBLIC)
self.assert_default_image_has_public_access(profile_page) self.assert_default_image_has_public_access(profile_page)
......
...@@ -826,7 +826,7 @@ class ViewsTestCase(ModuleStoreTestCase, MilestonesTestCaseMixin): ...@@ -826,7 +826,7 @@ class ViewsTestCase(ModuleStoreTestCase, MilestonesTestCaseMixin):
response = self._submit_financial_assistance_form(data) response = self._submit_financial_assistance_form(data)
self.assertEqual(response.status_code, 204) self.assertEqual(response.status_code, 204)
__, ___, ticket_subject, ticket_body, tags, additional_info = mock_record_feedback.call_args[0] __, __, ticket_subject, __, tags, additional_info = mock_record_feedback.call_args[0]
mocked_kwargs = mock_record_feedback.call_args[1] mocked_kwargs = mock_record_feedback.call_args[1]
group_name = mocked_kwargs['group_name'] group_name = mocked_kwargs['group_name']
require_update = mocked_kwargs['require_update'] require_update = mocked_kwargs['require_update']
......
...@@ -27,7 +27,7 @@ def run_python(request): ...@@ -27,7 +27,7 @@ def run_python(request):
g = {} g = {}
try: try:
safe_exec(py_code, g) safe_exec(py_code, g)
except Exception as e: except Exception: # pylint: disable=broad-except
c['results'] = traceback.format_exc() c['results'] = traceback.format_exc()
else: else:
c['results'] = pprint.pformat(g) c['results'] = pprint.pformat(g)
......
...@@ -542,8 +542,6 @@ def get_thread_list( ...@@ -542,8 +542,6 @@ def get_thread_list(
"sort_order": order_direction, "sort_order": order_direction,
} }
text_search_rewrite = None
if view: if view:
if view in ["unread", "unanswered"]: if view in ["unread", "unanswered"]:
query_params[view] = "true" query_params[view] = "true"
......
...@@ -142,7 +142,7 @@ class ApiTest(TestCase): ...@@ -142,7 +142,7 @@ class ApiTest(TestCase):
def create_notes(self, num_notes, create=True): def create_notes(self, num_notes, create=True):
notes = [] notes = []
for n in range(num_notes): for __ in range(num_notes):
note = models.Note(**self.note) note = models.Note(**self.note)
if create: if create:
note.save() note.save()
...@@ -437,7 +437,7 @@ class NoteTest(TestCase): ...@@ -437,7 +437,7 @@ class NoteTest(TestCase):
note.clean(json.dumps({ note.clean(json.dumps({
'text': 'foo', 'text': 'foo',
'quote': 'bar', 'quote': 'bar',
'ranges': [{} for i in range(10)] # too many ranges 'ranges': [{} for __ in range(10)] # too many ranges
})) }))
def test_as_dict(self): def test_as_dict(self):
......
...@@ -1577,7 +1577,7 @@ class PaidCourseRegistration(OrderItem): ...@@ -1577,7 +1577,7 @@ class PaidCourseRegistration(OrderItem):
super(PaidCourseRegistration, cls).add_to_order(order, course_id, cost, currency=currency) super(PaidCourseRegistration, cls).add_to_order(order, course_id, cost, currency=currency)
item, created = cls.objects.get_or_create(order=order, user=order.user, course_id=course_id) item, __ = cls.objects.get_or_create(order=order, user=order.user, course_id=course_id)
item.status = order.status item.status = order.status
item.mode = course_mode.slug item.mode = course_mode.slug
item.qty = 1 item.qty = 1
......
...@@ -120,10 +120,7 @@ class ReportTypeTests(ModuleStoreTestCase): ...@@ -120,10 +120,7 @@ class ReportTypeTests(ModuleStoreTestCase):
refunded_certs = report.rows() refunded_certs = report.rows()
# check that we have the right number # check that we have the right number
num_certs = 0 self.assertEqual(len(list(refunded_certs)), 2)
for cert in refunded_certs:
num_certs += 1
self.assertEqual(num_certs, 2)
self.assertTrue(CertificateItem.objects.get(user=self.first_refund_user, course_id=self.course_key)) self.assertTrue(CertificateItem.objects.get(user=self.first_refund_user, course_id=self.course_key))
self.assertTrue(CertificateItem.objects.get(user=self.second_refund_user, course_id=self.course_key)) self.assertTrue(CertificateItem.objects.get(user=self.second_refund_user, course_id=self.course_key))
...@@ -210,18 +207,11 @@ class ItemizedPurchaseReportTest(ModuleStoreTestCase): ...@@ -210,18 +207,11 @@ class ItemizedPurchaseReportTest(ModuleStoreTestCase):
purchases = report.rows() purchases = report.rows()
# since there's not many purchases, just run through the generator to make sure we've got the right number # since there's not many purchases, just run through the generator to make sure we've got the right number
num_purchases = 0 self.assertEqual(len(list(purchases)), 2)
for item in purchases:
num_purchases += 1
self.assertEqual(num_purchases, 2)
report = initialize_report("itemized_purchase_report", self.now + self.FIVE_MINS, self.now + self.FIVE_MINS + self.FIVE_MINS) report = initialize_report("itemized_purchase_report", self.now + self.FIVE_MINS, self.now + self.FIVE_MINS + self.FIVE_MINS)
no_purchases = report.rows() no_purchases = report.rows()
self.assertEqual(len(list(no_purchases)), 0)
num_purchases = 0
for item in no_purchases:
num_purchases += 1
self.assertEqual(num_purchases, 0)
def test_purchased_csv(self): def test_purchased_csv(self):
""" """
......
...@@ -193,7 +193,7 @@ class StudentAccountUpdateTest(CacheIsolationTestCase, UrlResetMixin): ...@@ -193,7 +193,7 @@ class StudentAccountUpdateTest(CacheIsolationTestCase, UrlResetMixin):
self.client.logout() self.client.logout()
# Make many consecutive bad requests in an attempt to trigger the rate limiter # Make many consecutive bad requests in an attempt to trigger the rate limiter
for attempt in xrange(self.INVALID_ATTEMPTS): for __ in xrange(self.INVALID_ATTEMPTS):
self._change_password(email=self.NEW_EMAIL) self._change_password(email=self.NEW_EMAIL)
response = self._change_password(email=self.NEW_EMAIL) response = self._change_password(email=self.NEW_EMAIL)
......
...@@ -71,8 +71,8 @@ def mock_software_secure_post(url, headers=None, data=None, **kwargs): ...@@ -71,8 +71,8 @@ def mock_software_secure_post(url, headers=None, data=None, **kwargs):
) )
# The keys should be stored as Base64 strings, i.e. this should not explode # The keys should be stored as Base64 strings, i.e. this should not explode
photo_id_key = data_dict["PhotoIDKey"].decode("base64") data_dict["PhotoIDKey"].decode("base64")
user_photo_key = data_dict["UserPhotoKey"].decode("base64") data_dict["UserPhotoKey"].decode("base64")
response = requests.Response() response = requests.Response()
response.status_code = 200 response.status_code = 200
......
...@@ -83,7 +83,7 @@ class StartView(TestCase): ...@@ -83,7 +83,7 @@ class StartView(TestCase):
Test the case where the user has no pending `PhotoVerificationAttempts`, Test the case where the user has no pending `PhotoVerificationAttempts`,
but is just starting their first. but is just starting their first.
""" """
user = UserFactory.create(username="rusty", password="test") UserFactory.create(username="rusty", password="test")
self.client.login(username="rusty", password="test") self.client.login(username="rusty", password="test")
def must_be_logged_in(self): def must_be_logged_in(self):
......
...@@ -180,9 +180,6 @@ class TestPreferenceAPI(TestCase): ...@@ -180,9 +180,6 @@ class TestPreferenceAPI(TestCase):
""" """
Verifies the basic behavior of update_user_preferences. Verifies the basic behavior of update_user_preferences.
""" """
expected_user_preferences = {
self.test_preference_key: "new_value",
}
set_user_preference(self.user, self.test_preference_key, "new_value") set_user_preference(self.user, self.test_preference_key, "new_value")
self.assertEqual( self.assertEqual(
get_user_preference(self.user, self.test_preference_key), get_user_preference(self.user, self.test_preference_key),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment