Commit a0629003 by Ben Patterson

Merge pull request #6240 from edx/benp/fix-analytics-init

Mock out the underlying segment-io call.
parents 18f69809 e0f83ded
......@@ -424,6 +424,7 @@ class IntegrationTest(testutil.TestCase, test.TestCase):
request, strategy = self.get_request_and_strategy(
auth_entry=pipeline.AUTH_ENTRY_LOGIN, redirect_uri='social:complete')
strategy.backend.auth_complete = mock.MagicMock(return_value=self.fake_auth_complete(strategy))
pipeline.analytics.track = mock.MagicMock()
request.user = self.create_user_models_for_existing_account(
strategy, 'user@example.com', 'password', self.get_username(), skip_social_auth=True)
......@@ -558,6 +559,7 @@ class IntegrationTest(testutil.TestCase, test.TestCase):
request, strategy = self.get_request_and_strategy(
auth_entry=pipeline.AUTH_ENTRY_LOGIN, redirect_uri='social:complete')
strategy.backend.auth_complete = mock.MagicMock(return_value=self.fake_auth_complete(strategy))
pipeline.analytics.track = mock.MagicMock()
user = self.create_user_models_for_existing_account(
strategy, 'user@example.com', 'password', self.get_username())
self.assert_social_auth_exists_for_user(user, strategy)
......
......@@ -3,6 +3,7 @@ Tests for the Shopping Cart Models
"""
from decimal import Decimal
import datetime
import sys
import smtplib
from boto.exception import BotoServerError # this is a super-class of SESError and catches connection errors
......@@ -233,7 +234,9 @@ class OrderTest(ModuleStoreTestCase):
item = CertificateItem.add_to_order(cart, self.course_key, self.cost, 'honor')
# course enrollment object should be created but still inactive
self.assertFalse(CourseEnrollment.is_enrolled(self.user, self.course_key))
cart.purchase()
# the analytics client pipes output to stderr when using the default client
with patch('sys.stderr', sys.stdout.write):
cart.purchase()
self.assertTrue(CourseEnrollment.is_enrolled(self.user, self.course_key))
# test e-mail sending
......
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