Commit Graph

55 Commits

Author SHA1 Message Date
Aarif
a1406cddf2 replaced unittest assertions pytest assertions (#26528) 2021-02-18 18:09:45 +05:00
Jawayria
dd99f8e02d Resolved quality errors 2021-02-03 17:05:12 +05:00
Jawayria
6be60b2fcc Resolved quality failures 2021-02-03 13:13:00 +05:00
Jawayria
62bc555817 Applied pylint-amnesty to track 2021-02-03 13:10:42 +05:00
Tim McCormack
e0e03dec5f Use more appropriate hash when making tracking ID; document SECRET_KEY use (#26134)
- Make it easier to rotate `SECRET_KEY` by documenting this usage
  for both sensitivity and rotation process. (ARCHBOM-1676).
- Just use a hash of the secret rather than HMAC + MD5. We're not
  authenticating a message, so HMAC isn't really needed -- it just needs
  to be unique, deterministic, and irreversible. SHAKE allows generation
  of an arbitrary length hash without needing to truncate.

Also, rename tracking session ID generator for clarity -- there's no
encryption happening here.

Add additional test for existing claim of uniqueness.
2021-01-27 14:13:42 +00:00
Kyle McCormick
151bd13666 Use full names for common.djangoapps imports; warn when using old style (#25477)
* Generate common/djangoapps import shims for LMS
* Generate common/djangoapps import shims for Studio
* Stop appending project root to sys.path
* Stop appending common/djangoapps to sys.path
* Import from common.djangoapps.course_action_state instead of course_action_state
* Import from common.djangoapps.course_modes instead of course_modes
* Import from common.djangoapps.database_fixups instead of database_fixups
* Import from common.djangoapps.edxmako instead of edxmako
* Import from common.djangoapps.entitlements instead of entitlements
* Import from common.djangoapps.pipline_mako instead of pipeline_mako
* Import from common.djangoapps.static_replace instead of static_replace
* Import from common.djangoapps.student instead of student
* Import from common.djangoapps.terrain instead of terrain
* Import from common.djangoapps.third_party_auth instead of third_party_auth
* Import from common.djangoapps.track instead of track
* Import from common.djangoapps.util instead of util
* Import from common.djangoapps.xblock_django instead of xblock_django
* Add empty common/djangoapps/__init__.py to fix pytest collection
* Fix pylint formatting violations
* Exclude import_shims/ directory tree from linting
2020-11-10 07:02:01 -05:00
Aarif
98af9ce418 remove useless-supression warnings 2020-05-01 19:42:15 +05:00
Diana Huang
742868c2da Remove the tracking django backend and the TrackingLog tables. 2020-02-04 14:24:56 -05:00
Feanil Patel
046feb0cf0 Merge pull request #22649 from edx/feanil/fix_pep8
Fix all E303 pep8 errors.
2019-12-30 13:32:26 -05:00
Feanil Patel
6e3fe00fff Fix all E303 pep8 errors. 2019-12-30 12:25:38 -05:00
Feanil Patel
2df8b8226b Merge pull request #22643 from edx/feanil/2to3_asserts
Run `2to3 -f asserts . -w` on edx-platform.
2019-12-30 12:13:42 -05:00
Feanil Patel
9cf2f9f298 Run 2to3 -f future . -w
This will remove imports from __future__ that are no longer needed.

https://docs.python.org/3.5/library/2to3.html#2to3fixer-future
2019-12-30 10:35:30 -05:00
Feanil Patel
70294b0ad2 Run 2to3 -f asserts . -w on edx-platform.
https://docs.python.org/3.5/library/2to3.html#2to3fixer-asserts
2019-12-30 10:22:19 -05:00
Jeremy Bowman
6f18383142 Fix bytes/string handling in tracking middleware 2019-09-18 11:59:24 -04:00
Anthony Wee
b095ce15c8 INCR-124: Run python-modernize on common/djangoapps/track/tests (#20445)
* INCR-124: Run python-modernize on common/djangoapps/track/tests

* isort
2019-05-07 14:05:38 -04:00
cclauss
c0c935b685 Old style exceptions --> new style for Python 3 2019-02-19 13:09:23 +01:00
Brian Wilson
48a3db7ffa Fix synthesized URL emitted to Segment.
Add schema to URL synthesized from host and path.
2018-11-22 02:40:02 -05:00
Brian Wilson
9e417fb5e4 Add creation of url from host and path. 2018-11-19 14:36:07 -05:00
Gabe Mulley
5311509b19 Provide more context to calls to Segment.
Implementation for DE-1089.

Centralize the definition of context into a single method.  This is in
common/djangoapps/track because the context is originally set there by
middleware.
2018-11-15 20:56:10 -05:00
Eric Fischer
247bb50ed2 s/django.core.urlresolvers/django.urls/g
Django 1.10 deprecation fix for Hackathon XIX
Addresses PLAT-1397
2018-06-05 13:59:09 -04:00
Andy Armstrong
93235d118d Reorder imports using isort (except lms and cms) 2017-05-30 16:04:54 -04:00
Diana Huang
e12a704cea Add new course dates fragment.
Also add it to the course home page.
2017-05-04 20:53:42 -04:00
Calen Pennington
3207311e50 Use copies of tracker settings dicts in tests so that changes don't leak between tests 2016-06-06 13:19:52 -04:00
J. Clifford Dyer
001874c42e Update seq_* to edx.ui.lms.sequence.* format
seq_next, seq_prev, and seq_goto events are all renamed, and maintain
legacy compatibility.

This PR also introduces new EventTransformer framework to shim events
based on name prefix.

MA-2221
2016-04-22 13:38:41 -04:00
Syed Hassan Raza
0d6e0ac779 Add latin1 decoding to HTTP Headers 2016-03-08 12:44:55 +05:00
Gabe Mulley
239c3822a4 copy event on write 2016-02-12 06:27:53 -05:00
Syed Hassan Raza
de91ceaae2 Fix HTTP_USER_AGENT latin1 characters 2016-01-20 18:40:09 +05:00
Ned Batchelder
f5d0f3ff55 Remove useless pylint suppressions 2015-11-22 07:41:19 -05:00
Bill DeRusha
40a8608b0b Upgrade IP parsing in tracker middleware 2015-10-08 13:48:53 -04:00
aamir-khan
282b9449a4 ECOM-2150: Added the ga client fetching as a customer header in middleware 2015-09-09 14:50:12 +05:00
Waheed Ahmed
5e2c2b1e93 Fixed course_id pattern regex.
PLAT-776
2015-08-11 13:36:07 +05:00
Ned Batchelder
f54fe787c6 Remove needless 'disable=no-member' pragmas 2015-08-03 17:47:44 -04:00
Gabe Mulley
63b0378520 Ensure GA events have a course label if available 2015-05-18 13:25:12 -04:00
Ned Batchelder
78e9445aa1 Add super() calls to setUp/tearDown that are missing them
Also, I replaced a number of tearDown methods with addCleanup instead.
And also remove some unneeded patch.stopall() calls.
2015-05-14 18:14:21 -04:00
Gabe Mulley
4a8b0c5ef5 Make user_track use eventtracking 2015-05-06 20:57:46 -04:00
Ned Batchelder
7d799e34f3 Remove unused imports 2015-03-17 07:10:31 -04:00
Piotr Mitros
cf719a40ba Add referer and accept_language to tracking logs
3 line patch, together with a world of pain due to buggy code, broken abstractions in tests, etc.
2015-02-11 13:35:27 -05:00
Gabe Mulley
821c97fbb4 Implement shim for mobile video events.
This PR addresses the following issues:

1) All requests return a 200 OK unless there is an authorization failure. This is deliberate in case the secret key is compromised.
2) Push all of the nasty logic necessary to generate compatible video events into the LMS instead of trying to do that mapping on the mobile devices.
3) Stop using the deprecated "action" field in the segment.io event. According to their support team this field should not be used anymore and is just around for backwards compatibility reasons.

Fixes: AN-3818
2014-11-03 14:12:07 -05:00
Ben Patterson
3ef0653711 pylint cleanup. 2014-10-11 12:51:20 -04:00
Gabe Mulley
7900e8d346 Add event tracking endpoint to be called by segment.io 2014-09-09 07:25:54 -04:00
Renzo Lucioni
79461722de Re-use GA cookie when sending server-side events to Segment.io 2014-08-21 10:47:35 -04:00
Gabe Mulley
f7eb7df5c5 Remove duplicated data from legacy events
When event-tracking was fully integrated into the platform, some data was replicated in the context in the middleware and then later extracted and moved the old location by event-tracking. The legacy code path was not updated to remove this transient shim data from the context resulting in duplication of the information. This patch ensures that the transient information is removed from the context before emitting the event.

Fixes: AN-2369
2014-07-25 12:49:55 -04:00
Adam Palay
b584c1a848 skip failing test 2014-06-27 13:24:23 -04:00
Adam Palay
bd2f3c75f5 Explicitly skip tests in common unless we know we're running the LMS unittest suite 2014-06-23 16:28:53 -04:00
Brian Wilson
f9f4f1c57a Add additional tests for tracking of sessions. 2014-06-03 13:24:48 -04:00
Brian Wilson
119d7768bf Also use md5 for constructing key for hmac. 2014-06-02 12:31:44 -04:00
Brian Wilson
919b433847 Encrypt the session id before writing to tracking logs. 2014-06-02 11:03:41 -04:00
Gabe Mulley
36269bd5a8 Integrate event-tracking in to the LMS
Support incremental conversion of events from the old API to the new, in order to ensure the new system is working, enrollment events have been modified to make use of the new API.
2014-05-01 14:04:35 -04:00
David Baumgold
f25a7870a5 fix tests 2014-03-11 14:48:03 -04:00
Brian Wilson
7e31c95c45 Modify server_track to handle being called without a request. 2014-01-05 22:58:10 -05:00