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.
This commit is contained in:
Gabe Mulley
2018-11-15 16:13:14 -05:00
committed by Brian Wilson
26 changed files with 394 additions and 274 deletions

View File

@@ -72,7 +72,7 @@ class TestActivateAccount(TestCase):
LMS_SEGMENT_KEY="testkey",
MAILCHIMP_NEW_USER_LIST_ID="listid"
)
@patch('student.models.analytics.identify')
@patch('student.models.segment.identify')
def test_activation_with_keys(self, mock_segment_identify):
expected_segment_payload = {
'email': self.email,
@@ -98,16 +98,16 @@ class TestActivateAccount(TestCase):
)
@override_settings(LMS_SEGMENT_KEY="testkey")
@patch('student.models.analytics.identify')
@patch('student.models.segment.identify')
def test_activation_without_mailchimp_key(self, mock_segment_identify):
self.assert_no_tracking(mock_segment_identify)
@override_settings(MAILCHIMP_NEW_USER_LIST_ID="listid")
@patch('student.models.analytics.identify')
@patch('student.models.segment.identify')
def test_activation_without_segment_key(self, mock_segment_identify):
self.assert_no_tracking(mock_segment_identify)
@patch('student.models.analytics.identify')
@patch('student.models.segment.identify')
def test_activation_without_keys(self, mock_segment_identify):
self.assert_no_tracking(mock_segment_identify)