Commit 19f1daca by Sarina Canelake

s/pylint: disable=E1101/pylint: disable=no-member/

parent 134effa8
# -*- coding: utf-8 -*-
# pylint: disable=E1101
# pylint: disable=W0212
import copy
......
# -*- coding: utf-8 -*-
# pylint: disable=E1101
# pylint: disable=no-member
# pylint: disable=protected-access
"""
Tests for import_from_xml using the mongo modulestore.
......
# pylint: disable=E1101
# pylint: disable=no-member
'''
Utilities for contentstore tests
'''
......
# pylint: disable=E1101
# pylint: disable=no-member
import copy
import logging
......
......@@ -45,8 +45,8 @@ class TestTransferStudents(ModuleStoreTestCase):
def test_transfer_students(self):
""" Verify the transfer student command works as intended. """
student = UserFactory.create()
student.set_password(self.PASSWORD) # pylint: disable=E1101
student.save() # pylint: disable=E1101
student.set_password(self.PASSWORD) # pylint: disable=no-member
student.save() # pylint: disable=no-member
mode = 'verified'
# Original Course
original_course_location = locator.CourseLocator('Org0', 'Course0', 'Run0')
......
......@@ -2,7 +2,7 @@
Browser set up for acceptance tests.
"""
# pylint: disable=E1101
# pylint: disable=no-member
# pylint: disable=W0613
from lettuce import before, after, world
......
......@@ -36,7 +36,7 @@ YOUTUBE_API_URLS = {
}
@before.all # pylint: disable=E1101
@before.all # pylint: disable=no-member
def start_video_server():
"""
Serve the HTML5 Video Sources from a local port
......@@ -47,7 +47,7 @@ def start_video_server():
setattr(world, 'video_source', video_server)
@after.all # pylint: disable=E1101
@after.all # pylint: disable=no-member
def stop_video_server(_total):
"""
Stop the HTML5 Video Source server after all tests have executed
......@@ -57,7 +57,7 @@ def stop_video_server(_total):
video_server.shutdown()
@before.each_scenario # pylint: disable=E1101
@before.each_scenario # pylint: disable=no-member
def process_requires_tags(scenario):
"""
Process the scenario tags to make sure that any
......@@ -125,7 +125,7 @@ def is_youtube_available(urls):
return True
@after.each_scenario # pylint: disable=E1101
@after.each_scenario # pylint: disable=no-member
def stop_stubs(_scenario):
"""
Shut down any stub services that were started up for the scenario.
......@@ -136,7 +136,7 @@ def stop_stubs(_scenario):
stub_server.shutdown()
@after.each_scenario # pylint: disable=E1101
@after.each_scenario # pylint: disable=no-member
def clear_alerts(_scenario):
"""
Clear any alerts that might still exist, so that
......
# pylint: disable=E1101
# pylint: disable=no-member
"""
This file exposes a number of password complexity validators which can be optionally added to
account creation
......
# pylint: disable=E1101
# pylint: disable=no-member
# pylint: disable=W0212
# pylint: disable=no-name-in-module
from nose.tools import assert_equals, assert_raises, \
......
......@@ -19,10 +19,10 @@ class StudioEditableModule(object):
"""
contents = []
for child in self.descriptor.get_children(): # pylint: disable=E1101
for child in self.descriptor.get_children(): # pylint: disable=no-member
if can_reorder:
context['reorderable_items'].add(child.location)
child_module = self.system.get_module(child) # pylint: disable=E1101
child_module = self.system.get_module(child) # pylint: disable=no-member
rendered_child = child_module.render(StudioEditableModule.get_preview_view_name(child_module), context)
fragment.add_frag_resources(rendered_child)
......@@ -31,7 +31,7 @@ class StudioEditableModule(object):
'content': rendered_child.content
})
fragment.add_content(self.system.render_template("studio_render_children_view.html", { # pylint: disable=E1101
fragment.add_content(self.system.render_template("studio_render_children_view.html", { # pylint: disable=no-member
'items': contents,
'xblock_context': context,
'can_add': can_add,
......
......@@ -30,7 +30,7 @@ log = logging.getLogger(__name__)
# Disable no-member warning:
# pylint: disable=E1101
# pylint: disable=no-member
class VideoStudentViewHandlers(object):
......
......@@ -173,7 +173,7 @@ class TestEmailErrors(ModuleStoreTestCase):
entry = InstructorTask.create(course_id, "task_type", "task_key", "task_input", self.instructor)
task_input = {"email_id": -1}
with self.assertRaises(CourseEmail.DoesNotExist):
perform_delegate_email_batches(entry.id, course_id, task_input, "action_name") # pylint: disable=E1101
perform_delegate_email_batches(entry.id, course_id, task_input, "action_name") # pylint: disable=no-member
((log_str, __, email_id), __) = mock_log.warning.call_args
self.assertTrue(mock_log.warning.called)
self.assertIn('Failed to get CourseEmail with id', log_str)
......@@ -188,10 +188,10 @@ class TestEmailErrors(ModuleStoreTestCase):
email = CourseEmail(course_id=course_id)
email.save()
entry = InstructorTask.create(course_id, "task_type", "task_key", "task_input", self.instructor)
task_input = {"email_id": email.id} # pylint: disable=E1101
task_input = {"email_id": email.id} # pylint: disable=no-member
# (?i) is a regex for ignore case
with self.assertRaisesRegexp(ValueError, r"(?i)course not found"):
perform_delegate_email_batches(entry.id, course_id, task_input, "action_name") # pylint: disable=E1101
perform_delegate_email_batches(entry.id, course_id, task_input, "action_name") # pylint: disable=no-member
def test_nonexistent_to_option(self):
"""
......@@ -200,9 +200,9 @@ class TestEmailErrors(ModuleStoreTestCase):
email = CourseEmail(course_id=self.course.id, to_option="IDONTEXIST")
email.save()
entry = InstructorTask.create(self.course.id, "task_type", "task_key", "task_input", self.instructor)
task_input = {"email_id": email.id} # pylint: disable=E1101
task_input = {"email_id": email.id} # pylint: disable=no-member
with self.assertRaisesRegexp(Exception, 'Unexpected bulk email TO_OPTION found: IDONTEXIST'):
perform_delegate_email_batches(entry.id, self.course.id, task_input, "action_name") # pylint: disable=E1101
perform_delegate_email_batches(entry.id, self.course.id, task_input, "action_name") # pylint: disable=no-member
def test_wrong_course_id_in_task(self):
"""
......@@ -211,9 +211,9 @@ class TestEmailErrors(ModuleStoreTestCase):
email = CourseEmail(course_id=self.course.id, to_option=SEND_TO_ALL)
email.save()
entry = InstructorTask.create("bogus/task/id", "task_type", "task_key", "task_input", self.instructor)
task_input = {"email_id": email.id} # pylint: disable=E1101
task_input = {"email_id": email.id} # pylint: disable=no-member
with self.assertRaisesRegexp(ValueError, 'does not match task value'):
perform_delegate_email_batches(entry.id, self.course.id, task_input, "action_name") # pylint: disable=E1101
perform_delegate_email_batches(entry.id, self.course.id, task_input, "action_name") # pylint: disable=no-member
def test_wrong_course_id_in_email(self):
"""
......@@ -222,14 +222,14 @@ class TestEmailErrors(ModuleStoreTestCase):
email = CourseEmail(course_id=SlashSeparatedCourseKey("bogus", "course", "id"), to_option=SEND_TO_ALL)
email.save()
entry = InstructorTask.create(self.course.id, "task_type", "task_key", "task_input", self.instructor)
task_input = {"email_id": email.id} # pylint: disable=E1101
task_input = {"email_id": email.id} # pylint: disable=no-member
with self.assertRaisesRegexp(ValueError, 'does not match email value'):
perform_delegate_email_batches(entry.id, self.course.id, task_input, "action_name") # pylint: disable=E1101
perform_delegate_email_batches(entry.id, self.course.id, task_input, "action_name") # pylint: disable=no-member
def test_send_email_undefined_subtask(self):
# test at a lower level, to ensure that the course gets checked down below too.
entry = InstructorTask.create(self.course.id, "task_type", "task_key", "task_input", self.instructor)
entry_id = entry.id # pylint: disable=E1101
entry_id = entry.id # pylint: disable=no-member
to_list = ['test@test.com']
global_email_context = {'course_title': 'dummy course'}
subtask_id = "subtask-id-value"
......@@ -241,7 +241,7 @@ class TestEmailErrors(ModuleStoreTestCase):
def test_send_email_missing_subtask(self):
# test at a lower level, to ensure that the course gets checked down below too.
entry = InstructorTask.create(self.course.id, "task_type", "task_key", "task_input", self.instructor)
entry_id = entry.id # pylint: disable=E1101
entry_id = entry.id # pylint: disable=no-member
to_list = ['test@test.com']
global_email_context = {'course_title': 'dummy course'}
subtask_id = "subtask-id-value"
......@@ -255,7 +255,7 @@ class TestEmailErrors(ModuleStoreTestCase):
def test_send_email_completed_subtask(self):
# test at a lower level, to ensure that the course gets checked down below too.
entry = InstructorTask.create(self.course.id, "task_type", "task_key", "task_input", self.instructor)
entry_id = entry.id # pylint: disable=E1101
entry_id = entry.id # pylint: disable=no-member
subtask_id = "subtask-id-value"
initialize_subtask_info(entry, "emailed", 100, [subtask_id])
subtask_status = SubtaskStatus.create(subtask_id, state=SUCCESS)
......@@ -270,7 +270,7 @@ class TestEmailErrors(ModuleStoreTestCase):
def test_send_email_running_subtask(self):
# test at a lower level, to ensure that the course gets checked down below too.
entry = InstructorTask.create(self.course.id, "task_type", "task_key", "task_input", self.instructor)
entry_id = entry.id # pylint: disable=E1101
entry_id = entry.id # pylint: disable=no-member
subtask_id = "subtask-id-value"
initialize_subtask_info(entry, "emailed", 100, [subtask_id])
subtask_status = SubtaskStatus.create(subtask_id)
......@@ -285,7 +285,7 @@ class TestEmailErrors(ModuleStoreTestCase):
def test_send_email_retried_subtask(self):
# test at a lower level, to ensure that the course gets checked down below too.
entry = InstructorTask.create(self.course.id, "task_type", "task_key", "task_input", self.instructor)
entry_id = entry.id # pylint: disable=E1101
entry_id = entry.id # pylint: disable=no-member
subtask_id = "subtask-id-value"
initialize_subtask_info(entry, "emailed", 100, [subtask_id])
subtask_status = SubtaskStatus.create(subtask_id, state=RETRY, retried_nomax=2)
......@@ -305,7 +305,7 @@ class TestEmailErrors(ModuleStoreTestCase):
def test_send_email_with_locked_instructor_task(self):
# test at a lower level, to ensure that the course gets checked down below too.
entry = InstructorTask.create(self.course.id, "task_type", "task_key", "task_input", self.instructor)
entry_id = entry.id # pylint: disable=E1101
entry_id = entry.id # pylint: disable=no-member
subtask_id = "subtask-id-locked-model"
initialize_subtask_info(entry, "emailed", 100, [subtask_id])
subtask_status = SubtaskStatus.create(subtask_id)
......@@ -321,7 +321,7 @@ class TestEmailErrors(ModuleStoreTestCase):
def test_send_email_undefined_email(self):
# test at a lower level, to ensure that the course gets checked down below too.
entry = InstructorTask.create(self.course.id, "task_type", "task_key", "task_input", self.instructor)
entry_id = entry.id # pylint: disable=E1101
entry_id = entry.id # pylint: disable=no-member
to_list = ['test@test.com']
global_email_context = {'course_title': 'dummy course'}
subtask_id = "subtask-id-undefined-email"
......
......@@ -91,7 +91,7 @@ class TestBulkEmailInstructorTask(InstructorTaskCourseTestCase):
to_option = SEND_TO_ALL
course_id = course_id or self.course.id
course_email = CourseEmail.create(course_id, self.instructor, to_option, "Test Subject", "<p>This is a test message</p>")
task_input = {'email_id': course_email.id} # pylint: disable=E1101
task_input = {'email_id': course_email.id} # pylint: disable=no-member
task_id = str(uuid4())
instructor_task = InstructorTaskFactory.create(
course_id=course_id,
......@@ -134,7 +134,7 @@ class TestBulkEmailInstructorTask(InstructorTaskCourseTestCase):
with self.assertRaises(ValueError):
with patch('bulk_email.tasks.update_subtask_status', dummy_update_subtask_status):
send_bulk_course_email(task_entry.id, {}) # pylint: disable=E1101
send_bulk_course_email(task_entry.id, {}) # pylint: disable=no-member
def _create_students(self, num_students):
"""Create students for testing"""
......
......@@ -58,7 +58,7 @@ def course_wiki_redirect(request, course_id): # pylint: disable=W0613
new_site.domain = settings.SITE_NAME
new_site.name = "edX"
new_site.save()
site_id = str(new_site.id) # pylint: disable=E1101
site_id = str(new_site.id) # pylint: disable=no-member
if site_id != str(settings.SITE_ID):
raise ImproperlyConfigured("No site object was created and the SITE_ID doesn't match the newly created one. {} != {}".format(site_id, settings.SITE_ID))
......
......@@ -219,7 +219,7 @@ class StorageTestBase(object):
"""
# Disable pylint warnings that arise because of the way the child classes call
# this base class -- pylint's static analysis can't keep up with it.
# pylint: disable=E1101, E1102
# pylint: disable=no-member, E1102
factory = None
scope = None
......
......@@ -106,8 +106,8 @@ def when_i_send_an_email(step, recipient): # pylint: disable=unused-argument
)
# Clear the queue of existing emails
while not mail.queue.empty(): # pylint: disable=E1101
mail.queue.get() # pylint: disable=E1101
while not mail.queue.empty(): # pylint: disable=no-member
mail.queue.get() # pylint: disable=no-member
# Because we flush the database before each run,
# we need to ensure that the email template fixture
......@@ -156,8 +156,8 @@ def then_the_email_is_sent(step, recipient): # pylint: disable=unused-argument
# Retrieve messages. Because we are using celery in "always eager"
# mode, we expect all messages to be sent by this point.
messages = []
while not mail.queue.empty(): # pylint: disable=E1101
messages.append(mail.queue.get()) # pylint: disable=E1101
while not mail.queue.empty(): # pylint: disable=no-member
messages.append(mail.queue.get()) # pylint: disable=no-member
# Check that we got the right number of messages
assert_equal(
......
......@@ -253,7 +253,7 @@ class TestECommerceDashboardViews(ModuleStoreTestCase):
response = self.client.post(self.url)
self.assertTrue('<td>AS452</td>' in response.content)
data = {
'coupon_id': coupon.id, 'code': 'AS452', 'discount': '10', 'description': 'updated_description', # pylint: disable=E1101
'coupon_id': coupon.id, 'code': 'AS452', 'discount': '10', 'description': 'updated_description', # pylint: disable=no-member
'course_id': coupon.course_id.to_deprecated_string()
}
# URL for update_coupon
......
......@@ -1709,7 +1709,7 @@ def send_email(request, course_id):
)
# Submit the task, so that the correct InstructorTask object gets created (for monitoring purposes)
instructor_task.api.submit_bulk_course_email(request, course_id, email.id) # pylint: disable=E1101
instructor_task.api.submit_bulk_course_email(request, course_id, email.id) # pylint: disable=no-member
response_payload = {
'course_id': course_id.to_deprecated_string(),
......
......@@ -860,7 +860,7 @@ def instructor_dashboard(request, course_id):
)
# Submit the task, so that the correct InstructorTask object gets created (for monitoring purposes)
submit_bulk_course_email(request, course_key, email.id) # pylint: disable=E1101
submit_bulk_course_email(request, course_key, email.id) # pylint: disable=no-member
except Exception as err: # pylint: disable=broad-except
# Catch any errors and deliver a message to the user
......
......@@ -301,7 +301,7 @@ def submit_task(request, task_type, task_class, course_key, task_input, task_key
# submit task:
task_id = instructor_task.task_id
task_args = [instructor_task.id, _get_xmodule_instance_args(request, task_id)] # pylint: disable=E1101
task_args = [instructor_task.id, _get_xmodule_instance_args(request, task_id)] # pylint: disable=no-member
task_class.apply_async(task_args, task_id=task_id)
return instructor_task
......@@ -307,7 +307,7 @@ def queue_subtasks_for_query(entry, action_name, create_subtask_fcn, item_querys
entry.id,
total_num_subtasks,
total_num_items,
) # pylint: disable=E1101
) # pylint: disable=no-member
progress = initialize_subtask_info(entry, action_name, total_num_items, subtask_id_list)
# Construct a generator that will return the recipients to use for each subtask.
......
......@@ -170,7 +170,7 @@ class InstructorTaskCourseSubmitTest(TestReportMixin, InstructorTaskCourseTestCa
def _define_course_email(self):
"""Create CourseEmail object for testing."""
course_email = CourseEmail.create(self.course.id, self.instructor, SEND_TO_ALL, "Test Subject", "<p>This is a test message</p>")
return course_email.id # pylint: disable=E1101
return course_email.id # pylint: disable=no-member
def _test_resubmission(self, api_call):
"""
......@@ -181,7 +181,7 @@ class InstructorTaskCourseSubmitTest(TestReportMixin, InstructorTaskCourseTestCa
`AlreadyRunningError`.
"""
instructor_task = api_call()
instructor_task = InstructorTask.objects.get(id=instructor_task.id) # pylint: disable=E1101
instructor_task = InstructorTask.objects.get(id=instructor_task.id) # pylint: disable=no-member
instructor_task.task_state = PROGRESS
instructor_task.save()
with self.assertRaises(AlreadyRunningError):
......
......@@ -122,7 +122,7 @@ class TestUserApi(ModuleStoreTestCase, APITestCase):
def test_course_serializer(self):
self.client.login(username=self.username, password=self.password)
self._enroll(self.course)
serialized = CourseEnrollmentSerializer(CourseEnrollment.enrollments_for_user(self.user)[0]).data # pylint: disable=E1101
serialized = CourseEnrollmentSerializer(CourseEnrollment.enrollments_for_user(self.user)[0]).data # pylint: disable=no-member
self.assertEqual(serialized['course']['video_outline'], None)
self.assertEqual(serialized['course']['name'], self.course.display_name)
self.assertEqual(serialized['course']['number'], self.course.id.course)
......@@ -135,7 +135,7 @@ class TestUserApi(ModuleStoreTestCase, APITestCase):
self.client.login(username=self.username, password=self.password)
self._enroll(self.course)
serialized = CourseEnrollmentSerializer(CourseEnrollment.enrollments_for_user(self.user)[0]).data # pylint: disable=E1101
serialized = CourseEnrollmentSerializer(CourseEnrollment.enrollments_for_user(self.user)[0]).data # pylint: disable=no-member
self.assertEqual(serialized['course']['number'], self.course.display_coursenumber)
self.assertEqual(serialized['course']['org'], self.course.display_organization)
......
......@@ -405,7 +405,7 @@ class ShoppingCartViewsTests(ModuleStoreTestCase):
item = self.cart.orderitem_set.all().select_subclasses()[1]
self.assertEquals(item.unit_cost, self.get_discount(self.testing_cost))
def test_soft_delete_coupon(self): # pylint: disable=E1101
def test_soft_delete_coupon(self): # pylint: disable=no-member
self.add_coupon(self.course_key, True, self.coupon_code)
coupon = Coupon(code='TestCode', description='testing', course_id=self.course_key,
percentage_discount=12, created_by=self.user, is_active=True)
......@@ -416,25 +416,25 @@ class ShoppingCartViewsTests(ModuleStoreTestCase):
get_coupon = Coupon.objects.get(id=1)
request = HttpRequest()
request.user = admin
setattr(request, 'session', 'session') # pylint: disable=E1101
messages = FallbackStorage(request) # pylint: disable=E1101
setattr(request, '_messages', messages) # pylint: disable=E1101
setattr(request, 'session', 'session') # pylint: disable=no-member
messages = FallbackStorage(request) # pylint: disable=no-member
setattr(request, '_messages', messages) # pylint: disable=no-member
coupon_admin = SoftDeleteCouponAdmin(Coupon, AdminSite())
test_query_set = coupon_admin.queryset(request)
test_actions = coupon_admin.get_actions(request)
self.assertTrue('really_delete_selected' in test_actions['really_delete_selected'])
self.assertEqual(get_coupon.is_active, True)
coupon_admin.really_delete_selected(request, test_query_set) # pylint: disable=E1101
coupon_admin.really_delete_selected(request, test_query_set) # pylint: disable=no-member
for coupon in test_query_set:
self.assertEqual(coupon.is_active, False)
coupon_admin.delete_model(request, get_coupon) # pylint: disable=E1101
coupon_admin.delete_model(request, get_coupon) # pylint: disable=no-member
self.assertEqual(get_coupon.is_active, False)
coupon = Coupon(code='TestCode123', description='testing123', course_id=self.course_key,
percentage_discount=22, created_by=self.user, is_active=True)
coupon.save()
test_query_set = coupon_admin.queryset(request)
coupon_admin.really_delete_selected(request, test_query_set) # pylint: disable=E1101
coupon_admin.really_delete_selected(request, test_query_set) # pylint: disable=no-member
for coupon in test_query_set:
self.assertEqual(coupon.is_active, False)
......
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