Applied pylint-amnesty to track

This commit is contained in:
Jawayria
2021-02-02 14:56:38 +05:00
parent e677be8329
commit 62bc555817
24 changed files with 75 additions and 75 deletions

View File

@@ -24,4 +24,4 @@ class BaseBackend(six.with_metaclass(abc.ABCMeta, object)):
@abc.abstractmethod
def send(self, event):
"""Send event to tracker."""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass

View File

@@ -28,7 +28,7 @@ class LoggerBackend(BaseBackend):
been configured using the default python mechanisms.
"""
super(LoggerBackend, self).__init__(**kwargs)
super(LoggerBackend, self).__init__(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self.event_logger = logging.getLogger(name)

View File

@@ -33,7 +33,7 @@ class MongoBackend(BaseBackend):
"""
super(MongoBackend, self).__init__(**kwargs)
super(MongoBackend, self).__init__(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
# Extract connection parameters from kwargs

View File

@@ -1,4 +1,4 @@
# lint-amnesty, pylint: disable=missing-module-docstring
from django.test import TestCase
from mock import patch
@@ -6,9 +6,9 @@ from mock import patch
from common.djangoapps.track.backends.mongodb import MongoBackend
class TestMongoBackend(TestCase):
class TestMongoBackend(TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
def setUp(self):
super(TestMongoBackend, self).setUp()
super(TestMongoBackend, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.mongo_patcher = patch('common.djangoapps.track.backends.mongodb.MongoClient')
self.mongo_patcher.start()
self.addCleanup(self.mongo_patcher.stop)

View File

@@ -1,4 +1,4 @@
# lint-amnesty, pylint: disable=missing-module-docstring
import json
from six import StringIO

View File

@@ -5,7 +5,7 @@ from django.core.management.base import BaseCommand
from eventtracking import tracker
class TrackedCommand(BaseCommand):
class TrackedCommand(BaseCommand): # lint-amnesty, pylint: disable=abstract-method
"""
Provides management command calling info to tracking context.
@@ -44,10 +44,10 @@ class TrackedCommand(BaseCommand):
"""
prog_name = 'unknown'
def create_parser(self, prog_name, subcommand):
def create_parser(self, prog_name, subcommand): # lint-amnesty, pylint: disable=arguments-differ
"""Wraps create_parser to snag command line info."""
self.prog_name = "{} {}".format(prog_name, subcommand)
return super(TrackedCommand, self).create_parser(prog_name, subcommand)
return super(TrackedCommand, self).create_parser(prog_name, subcommand) # lint-amnesty, pylint: disable=super-with-arguments
def execute(self, *args, **options):
"""Wraps base execute() to add command line to tracking context."""
@@ -56,4 +56,4 @@ class TrackedCommand(BaseCommand):
}
COMMAND_CONTEXT_NAME = 'edx.mgmt.command'
with tracker.get_tracker().context(COMMAND_CONTEXT_NAME, context):
super(TrackedCommand, self).execute(*args, **options)
super(TrackedCommand, self).execute(*args, **options) # lint-amnesty, pylint: disable=super-with-arguments

View File

@@ -40,7 +40,7 @@ class TrackMiddleware(MiddlewareMixin):
emitted events.
"""
def process_request(self, request):
def process_request(self, request): # lint-amnesty, pylint: disable=missing-function-docstring
try:
self.enter_request_context(request)
@@ -81,7 +81,7 @@ class TrackMiddleware(MiddlewareMixin):
event = event[:512]
views.server_track(request, request.META['PATH_INFO'], event)
except:
except: # lint-amnesty, pylint: disable=bare-except
## Why do we have the overly broad except?
##
## I added instrumentation so if we drop events on the
@@ -93,7 +93,7 @@ class TrackMiddleware(MiddlewareMixin):
event = {'event-type': 'exception', 'exception': repr(sys.exc_info()[0])}
try:
views.server_track(request, request.META['PATH_INFO'], event)
except:
except: # lint-amnesty, pylint: disable=bare-except
# At this point, things are really broken. We really
# should fail return a 500 to the user here. However,
# the interim decision is to just fail in order to be

View File

@@ -29,7 +29,7 @@ def track(user_id, event_name, properties=None, context=None):
if 'ip' not in segment_context and 'ip' in tracking_context:
segment_context['ip'] = tracking_context.get('ip')
if ('Google Analytics' not in segment_context or 'clientId' not in segment_context['Google Analytics']) and 'client_id' in tracking_context:
if ('Google Analytics' not in segment_context or 'clientId' not in segment_context['Google Analytics']) and 'client_id' in tracking_context: # lint-amnesty, pylint: disable=line-too-long
segment_context['Google Analytics'] = {
'clientId': tracking_context.get('client_id')
}

View File

@@ -22,7 +22,7 @@ class InMemoryBackend(object):
"""A backend that simply stores all events in memory"""
def __init__(self):
super(InMemoryBackend, self).__init__()
super(InMemoryBackend, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments
self.events = []
def send(self, event):
@@ -48,7 +48,7 @@ class EventTrackingTestCase(TestCase):
freezer.start()
self.addCleanup(freezer.stop)
super(EventTrackingTestCase, self).setUp()
super(EventTrackingTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.recreate_tracker()

View File

@@ -1,4 +1,4 @@
from unittest import TestCase
from unittest import TestCase # lint-amnesty, pylint: disable=missing-module-docstring
import ddt
@@ -6,7 +6,7 @@ from common.djangoapps.track import contexts
@ddt.ddt
class TestContexts(TestCase):
class TestContexts(TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
COURSE_ID = 'test/course_name/course_run'
SPLIT_COURSE_ID = 'course-v1:test+course_name+course_run'

View File

@@ -4,7 +4,7 @@
import ddt
import six
from django.contrib.auth.models import User
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.contrib.sessions.middleware import SessionMiddleware
from django.test import TestCase
from django.test.client import RequestFactory
@@ -20,7 +20,7 @@ class TrackMiddlewareTestCase(TestCase):
""" Class for checking tracking requests """
def setUp(self):
super(TrackMiddlewareTestCase, self).setUp()
super(TrackMiddlewareTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.track_middleware = TrackMiddleware()
self.request_factory = RequestFactory()

View File

@@ -16,7 +16,7 @@ class SegmentTrackTestCase(TestCase):
"""Ensure emitted events contain the expected context values."""
def setUp(self):
super(SegmentTrackTestCase, self).setUp()
super(SegmentTrackTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.tracker = DjangoTracker()
tracker.register_tracker(self.tracker)
self.properties = {sentinel.key: sentinel.value}
@@ -43,7 +43,7 @@ class SegmentTrackTestCase(TestCase):
def test_track_without_tracking_context(self):
segment.track(sentinel.user_id, sentinel.name, self.properties)
self.assertTrue(self.mock_segment_track.called)
args, kwargs = self.mock_segment_track.call_args
args, kwargs = self.mock_segment_track.call_args # lint-amnesty, pylint: disable=unused-variable
expected_segment_context = {}
self.assertEqual((sentinel.user_id, sentinel.name, self.properties, expected_segment_context), args)
@@ -52,16 +52,16 @@ class SegmentTrackTestCase(TestCase):
({'ip': sentinel.ip}, {'ip': sentinel.provided_ip}, {'ip': sentinel.ip}),
({'agent': sentinel.agent}, {'userAgent': sentinel.provided_agent}, {'userAgent': sentinel.agent}),
({'path': sentinel.path}, {'page': {'path': sentinel.provided_path}}, {'page': {'path': sentinel.path}}),
({'referer': sentinel.referer}, {'page': {'referrer': sentinel.provided_referer}}, {'page': {'referrer': sentinel.referer}}),
({'referer': sentinel.referer}, {'page': {'referrer': sentinel.provided_referer}}, {'page': {'referrer': sentinel.referer}}), # lint-amnesty, pylint: disable=line-too-long
({'page': sentinel.page}, {'page': {'url': sentinel.provided_page}}, {'page': {'url': sentinel.page}}),
({'client_id': sentinel.client_id}, {'Google Analytics': {'clientId': sentinel.provided_client_id}}, {'Google Analytics': {'clientId': sentinel.client_id}}),
({'client_id': sentinel.client_id}, {'Google Analytics': {'clientId': sentinel.provided_client_id}}, {'Google Analytics': {'clientId': sentinel.client_id}}), # lint-amnesty, pylint: disable=line-too-long
)
@override_settings(LMS_SEGMENT_KEY="testkey")
def test_track_context_with_stuff(self, tracking_context, provided_context, expected_segment_context):
# Test first with tracking and no provided context.
with self.tracker.context('test', tracking_context):
segment.track(sentinel.user_id, sentinel.name, self.properties)
args, kwargs = self.mock_segment_track.call_args
args, kwargs = self.mock_segment_track.call_args # lint-amnesty, pylint: disable=unused-variable
self.assertEqual((sentinel.user_id, sentinel.name, self.properties, expected_segment_context), args)
# Test with provided context and no tracking context.
@@ -98,7 +98,7 @@ class SegmentTrackTestCase(TestCase):
segment.track(sentinel.user_id, sentinel.name, self.properties)
self.assertTrue(self.mock_segment_track.called)
args, kwargs = self.mock_segment_track.call_args
args, kwargs = self.mock_segment_track.call_args # lint-amnesty, pylint: disable=unused-variable
expected_segment_context = {
'ip': sentinel.ip,
@@ -119,7 +119,7 @@ class SegmentIdentifyTestCase(TestCase):
"""Ensure emitted events contain the fields legacy processors expect to find."""
def setUp(self):
super(SegmentIdentifyTestCase, self).setUp()
super(SegmentIdentifyTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
patcher = patch('common.djangoapps.track.segment.analytics.identify')
self.mock_segment_identify = patcher.start()
self.addCleanup(patcher.stop)
@@ -138,7 +138,7 @@ class SegmentIdentifyTestCase(TestCase):
def test_normal_call(self):
segment.identify(sentinel.user_id, self.properties)
self.assertTrue(self.mock_segment_identify.called)
args, kwargs = self.mock_segment_identify.call_args
args, kwargs = self.mock_segment_identify.call_args # lint-amnesty, pylint: disable=unused-variable
self.assertEqual((sentinel.user_id, self.properties, {}), args)
@override_settings(LMS_SEGMENT_KEY="testkey")
@@ -146,5 +146,5 @@ class SegmentIdentifyTestCase(TestCase):
provided_context = {sentinel.context_key: sentinel.context_value}
segment.identify(sentinel.user_id, self.properties, provided_context)
self.assertTrue(self.mock_segment_identify.called)
args, kwargs = self.mock_segment_identify.call_args
args, kwargs = self.mock_segment_identify.call_args # lint-amnesty, pylint: disable=unused-variable
self.assertEqual((sentinel.user_id, self.properties, provided_context), args)

View File

@@ -234,7 +234,7 @@ class EventTransformerRegistryTestCase(EventTrackingTestCase):
"""
def setUp(self):
super(EventTransformerRegistryTestCase, self).setUp()
super(EventTransformerRegistryTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.registry = transformers.EventTransformerRegistry()
@ddt.data(

View File

@@ -1,4 +1,4 @@
# lint-amnesty, pylint: disable=missing-module-docstring
from django.conf import settings
from django.test import TestCase
@@ -31,7 +31,7 @@ class TestTrackerInstantiation(TestCase):
"""Test that a helper function can instantiate backends from their name."""
def setUp(self):
# pylint: disable=protected-access
super(TestTrackerInstantiation, self).setUp()
super(TestTrackerInstantiation, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.get_backend = tracker._instantiate_backend_from_name
def test_instatiate_backend(self):
@@ -100,7 +100,7 @@ class TestTrackerDjangoInstantiation(TestCase):
self.assertEqual(len(backends), 1)
def _reload_backends(self):
def _reload_backends(self): # lint-amnesty, pylint: disable=missing-function-docstring
# pylint: disable=protected-access
# Reset backends
@@ -109,9 +109,9 @@ class TestTrackerDjangoInstantiation(TestCase):
return tracker.backends
class DummyBackend(BaseBackend):
class DummyBackend(BaseBackend): # lint-amnesty, pylint: disable=missing-class-docstring
def __init__(self, **options):
super(DummyBackend, self).__init__(**options)
super(DummyBackend, self).__init__(**options) # lint-amnesty, pylint: disable=super-with-arguments
self.flag = options.get('flag', False)
self.count = 0

View File

@@ -1,4 +1,4 @@
# lint-amnesty, pylint: disable=missing-module-docstring
import json
from datetime import datetime
@@ -9,7 +9,7 @@ from pytz import UTC
from common.djangoapps.track.utils import DateTimeJSONEncoder
class TestDateTimeJSONEncoder(TestCase):
class TestDateTimeJSONEncoder(TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
def test_datetime_encoding(self):
a_naive_datetime = datetime(2012, 5, 1, 7, 27, 10, 20000)
a_tz_datetime = datetime(2012, 5, 1, 7, 27, 10, 20000, tzinfo=UTC)

View File

@@ -67,7 +67,7 @@ def _instantiate_backend_from_name(name, options):
module_name = '.'.join(parts[:-1])
class_name = parts[-1]
except IndexError:
raise ValueError('Invalid event track backend %s' % name)
raise ValueError('Invalid event track backend %s' % name) # lint-amnesty, pylint: disable=raise-missing-from
# Get and verify the backend class
@@ -77,7 +77,7 @@ def _instantiate_backend_from_name(name, options):
if not inspect.isclass(cls) or not issubclass(cls, BaseBackend):
raise TypeError
except (ValueError, AttributeError, TypeError, ImportError):
raise ValueError('Cannot find event track backend %s' % name)
raise ValueError('Cannot find event track backend %s' % name) # lint-amnesty, pylint: disable=raise-missing-from
backend = cls(**options)
@@ -92,7 +92,7 @@ def send(event):
warnings.warn(
'track.tracker module is deprecated. Please use eventtracking to send events.', DeprecationWarning
)
for name, backend in six.iteritems(backends):
for name, backend in six.iteritems(backends): # lint-amnesty, pylint: disable=unused-variable
backend.send(event)

View File

@@ -184,7 +184,7 @@ class EventTransformer(dict):
always be run.
"""
def __init__(self, *args, **kwargs):
super(EventTransformer, self).__init__(*args, **kwargs)
super(EventTransformer, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self.load_payload()
# Properties to be overridden
@@ -261,14 +261,14 @@ class EventTransformer(dict):
Override this method to specify how to update event fields to maintain
compatibility with legacy events.
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
def process_event(self):
"""
Override this method to make unconditional modifications to event
fields.
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
@EventTransformerRegistry.register
@@ -395,7 +395,7 @@ class VideoEventTransformer(EventTransformer):
expected types of events.
"""
if self.name in self.name_to_event_type_map:
super(VideoEventTransformer, self).transform()
super(VideoEventTransformer, self).transform() # lint-amnesty, pylint: disable=super-with-arguments
def process_event(self):
"""

View File

@@ -3,7 +3,7 @@ URLs for track app
"""
from django.conf import settings
from django.conf import settings # lint-amnesty, pylint: disable=unused-import
from django.conf.urls import url
from . import views

View File

@@ -10,7 +10,7 @@ from pytz import UTC
class DateTimeJSONEncoder(json.JSONEncoder):
"""JSON encoder aware of datetime.datetime and datetime.date objects"""
def default(self, obj): # pylint: disable=method-hidden
def default(self, obj): # lint-amnesty, pylint: disable=arguments-differ, method-hidden
"""
Serialize datetime and date objects of iso format.
@@ -20,7 +20,7 @@ class DateTimeJSONEncoder(json.JSONEncoder):
if isinstance(obj, datetime):
if obj.tzinfo is None:
# Localize to UTC naive datetime objects
obj = UTC.localize(obj)
obj = UTC.localize(obj) # lint-amnesty, pylint: disable=no-value-for-parameter
else:
# Convert to UTC datetime objects from other timezones
obj = obj.astimezone(UTC)
@@ -28,4 +28,4 @@ class DateTimeJSONEncoder(json.JSONEncoder):
elif isinstance(obj, date):
return obj.isoformat()
return super(DateTimeJSONEncoder, self).default(obj)
return super(DateTimeJSONEncoder, self).default(obj) # lint-amnesty, pylint: disable=super-with-arguments

View File

@@ -1,9 +1,9 @@
# lint-amnesty, pylint: disable=missing-module-docstring
import json
import six
from django.contrib.auth.models import User
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.http import HttpResponse
from eventtracking import tracker as eventtracker
from ipware.ip import get_ip
@@ -73,7 +73,7 @@ def user_track(request):
"""
try:
username = request.user.username
except:
except: # lint-amnesty, pylint: disable=bare-except
username = "anonymous"
name = _get_request_value(request, 'event_type')
@@ -109,7 +109,7 @@ def server_track(request, event_type, event, page=None):
try:
username = request.user.username
except:
except: # lint-amnesty, pylint: disable=bare-except
username = "anonymous"
context_override = _get_course_context(page)

View File

@@ -6,7 +6,7 @@ import logging
from dateutil import parser
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST
@@ -86,7 +86,7 @@ def segmentio_event(request):
class EventValidationError(Exception):
"""Raised when an invalid event is received."""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
def track_segmentio_event(request): # pylint: disable=too-many-statements
@@ -165,13 +165,13 @@ def track_segmentio_event(request): # pylint: disable=too-many-statements
if 'data' not in segment_properties:
raise EventValidationError(ERROR_MISSING_DATA)
segment_event_data = segment_properties.get('data', {})
if type(segment_event_data) is not dict:
if type(segment_event_data) is not dict: # lint-amnesty, pylint: disable=unidiomatic-typecheck
set_custom_attribute('segment_unexpected_data', str(segment_event_data))
raise EventValidationError(ERROR_INVALID_DATA_FIELD_TYPE)
# create and populate application field if it doesn't exist
app_context = segment_properties.get('context', {})
if type(app_context) is not dict:
if type(app_context) is not dict: # lint-amnesty, pylint: disable=unidiomatic-typecheck
set_custom_attribute('segment_unexpected_context', str(app_context))
raise EventValidationError(ERROR_INVALID_CONTEXT_FIELD_TYPE)
if 'application' not in app_context:
@@ -202,9 +202,9 @@ def track_segmentio_event(request): # pylint: disable=too-many-statements
try:
user = User.objects.get(pk=user_id)
except User.DoesNotExist:
raise EventValidationError(ERROR_USER_NOT_EXIST)
raise EventValidationError(ERROR_USER_NOT_EXIST) # lint-amnesty, pylint: disable=raise-missing-from
except ValueError:
raise EventValidationError(ERROR_INVALID_USER_ID)
raise EventValidationError(ERROR_INVALID_USER_ID) # lint-amnesty, pylint: disable=raise-missing-from
else:
context['user_id'] = user.id
context['username'] = user.username

View File

@@ -37,7 +37,7 @@ class SegmentIOTrackingTestCaseBase(EventTrackingTestCase):
"""
def setUp(self):
super(SegmentIOTrackingTestCaseBase, self).setUp()
super(SegmentIOTrackingTestCaseBase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.maxDiff = None # pylint: disable=invalid-name
self.request_factory = RequestFactory()

View File

@@ -5,14 +5,14 @@ import json
from dateutil import parser
from ddt import data, ddt, unpack
from django.contrib.auth.models import User
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.test.utils import override_settings
from mock import sentinel
from openedx.core.lib.tests.assertions.events import assert_event_matches
from common.djangoapps.track.middleware import TrackMiddleware
from common.djangoapps.track.views import segmentio
from common.djangoapps.track.views.tests.base import SEGMENTIO_TEST_ENDPOINT, SEGMENTIO_TEST_USER_ID, SegmentIOTrackingTestCaseBase
from common.djangoapps.track.views.tests.base import SEGMENTIO_TEST_ENDPOINT, SEGMENTIO_TEST_USER_ID, SegmentIOTrackingTestCaseBase # lint-amnesty, pylint: disable=line-too-long
def expect_failure_with_message(message):
@@ -32,7 +32,7 @@ class SegmentIOTrackingTestCase(SegmentIOTrackingTestCaseBase):
"""
def setUp(self):
super(SegmentIOTrackingTestCase, self).setUp()
super(SegmentIOTrackingTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
User.objects.create(pk=SEGMENTIO_TEST_USER_ID, username=str(sentinel.username))
@@ -367,29 +367,29 @@ class SegmentIOTrackingTestCase(SegmentIOTrackingTestCaseBase):
# Verify positive slide case. Verify slide to onSlideSeek. Verify
# edx.video.seeked emitted from iOS v1.0.02 is changed to
# edx.video.position.changed.
(1, 1, "seek_type", "slide", "onSlideSeek", "edx.video.seeked", "edx.video.position.changed", 'edx.mobileapp.iOS', '1.0.02'),
(1, 1, "seek_type", "slide", "onSlideSeek", "edx.video.seeked", "edx.video.position.changed", 'edx.mobileapp.iOS', '1.0.02'), # lint-amnesty, pylint: disable=line-too-long
# Verify negative slide case. Verify slide to onSlideSeek. Verify
# edx.video.seeked to edx.video.position.changed.
(-2, -2, "seek_type", "slide", "onSlideSeek", "edx.video.seeked", "edx.video.position.changed", 'edx.mobileapp.iOS', '1.0.02'),
(-2, -2, "seek_type", "slide", "onSlideSeek", "edx.video.seeked", "edx.video.position.changed", 'edx.mobileapp.iOS', '1.0.02'), # lint-amnesty, pylint: disable=line-too-long
# Verify +30 is changed to -30 which is incorrectly emitted in iOS
# v1.0.02. Verify skip to onSkipSeek
(30, -30, "seek_type", "skip", "onSkipSeek", "edx.video.position.changed", "edx.video.position.changed", 'edx.mobileapp.iOS', '1.0.02'),
(30, -30, "seek_type", "skip", "onSkipSeek", "edx.video.position.changed", "edx.video.position.changed", 'edx.mobileapp.iOS', '1.0.02'), # lint-amnesty, pylint: disable=line-too-long
# Verify the correct case of -30 is also handled as well. Verify skip
# to onSkipSeek
(-30, -30, "seek_type", "skip", "onSkipSeek", "edx.video.position.changed", "edx.video.position.changed", 'edx.mobileapp.iOS', '1.0.02'),
(-30, -30, "seek_type", "skip", "onSkipSeek", "edx.video.position.changed", "edx.video.position.changed", 'edx.mobileapp.iOS', '1.0.02'), # lint-amnesty, pylint: disable=line-too-long
# Verify positive slide case where onSkipSeek is changed to
# onSlideSkip. Verify edx.video.seeked emitted from Android v1.0.02 is
# changed to edx.video.position.changed.
(1, 1, "type", "onSkipSeek", "onSlideSeek", "edx.video.seeked", "edx.video.position.changed", 'edx.mobileapp.android', '1.0.02'),
(1, 1, "type", "onSkipSeek", "onSlideSeek", "edx.video.seeked", "edx.video.position.changed", 'edx.mobileapp.android', '1.0.02'), # lint-amnesty, pylint: disable=line-too-long
# Verify positive slide case where onSkipSeek is changed to
# onSlideSkip. Verify edx.video.seeked emitted from Android v1.0.02 is
# changed to edx.video.position.changed.
(-2, -2, "type", "onSkipSeek", "onSlideSeek", "edx.video.seeked", "edx.video.position.changed", 'edx.mobileapp.android', '1.0.02'),
(-2, -2, "type", "onSkipSeek", "onSlideSeek", "edx.video.seeked", "edx.video.position.changed", 'edx.mobileapp.android', '1.0.02'), # lint-amnesty, pylint: disable=line-too-long
# Verify positive skip case where onSkipSeek is not changed and does
# not become negative.
(30, 30, "type", "onSkipSeek", "onSkipSeek", "edx.video.position.changed", "edx.video.position.changed", 'edx.mobileapp.android', '1.0.02'),
(30, 30, "type", "onSkipSeek", "onSkipSeek", "edx.video.position.changed", "edx.video.position.changed", 'edx.mobileapp.android', '1.0.02'), # lint-amnesty, pylint: disable=line-too-long
# Verify positive skip case where onSkipSeek is not changed.
(-30, -30, "type", "onSkipSeek", "onSkipSeek", "edx.video.position.changed", "edx.video.position.changed", 'edx.mobileapp.android', '1.0.02')
(-30, -30, "type", "onSkipSeek", "onSkipSeek", "edx.video.position.changed", "edx.video.position.changed", 'edx.mobileapp.android', '1.0.02') # lint-amnesty, pylint: disable=line-too-long
)
@unpack
def test_previous_builds(self,

View File

@@ -1,6 +1,6 @@
import ddt
import ddt # lint-amnesty, pylint: disable=missing-module-docstring
import six
from django.contrib.auth.models import User
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.test.client import RequestFactory
from django.test.utils import override_settings
from mock import patch, sentinel
@@ -15,7 +15,7 @@ TEST_USER_ID = 1000
@ddt.ddt
class TestTrackViews(EventTrackingTestCase):
class TestTrackViews(EventTrackingTestCase): # lint-amnesty, pylint: disable=missing-class-docstring
@classmethod
def setUpTestData(cls):
@@ -23,7 +23,7 @@ class TestTrackViews(EventTrackingTestCase):
User.objects.create(pk=TEST_USER_ID, username=TEST_USERNAME)
def setUp(self):
super(TestTrackViews, self).setUp()
super(TestTrackViews, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.request_factory = RequestFactory()