Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Flaky test] lms/djangoapps/email_marketing/tests/test_signals.py::SailthruTests::test_update_course_enrollment #36015

Open
timmc-edx opened this issue Dec 11, 2024 · 0 comments
Labels
flaky-test Details a test removed as part of the flaky test process

Comments

@timmc-edx
Copy link
Contributor

timmc-edx commented Dec 11, 2024

This test fails intermittently and has been deleted according to the Flaky Test Process in #23075

See docs on how to address flaky tests for why this should be fixed and how to go about it.

Failure output:

Run Tests / lms-unit / lms.djangoapps.email_marketing.tests.test_signals.SailthruTests.test_update_course_enrollment (from pytest)

Failing for the past 1 build (Since Failed#14380 )
Took 25 ms.
Error Message
AssertionError: expected call not found. Expected: purchase('[email protected]', [{'id': 'edX/toy/2012_Fall-audit', 'url': 'http://lms.testserver.fake/courses/edX/toy/2012_Fall/info', 'price': 0, 'vars': {'course_run_id': 'edX/toy/2012_Fall', 'mode': 'audit'}, 'title': 'Course edX/toy/2012_Fall mode: audit', 'qty': 1}], options={}) Actual: purchase('[email protected]', [{'id': 'edX/toy/2012_Fall-audit', 'url': 'http://lms.testserver.fake/courses/edX/toy/2012_Fall/info', 'price': 0, 'vars': {'course_run_id': 'edX/toy/2012_Fall', 'mode': 'audit'}, 'title': 'Course edX/toy/2012_Fall mode: audit', 'qty': 1}], options={'send_template': 'enroll_template'})
Stacktrace
self = <test_signals.SailthruTests testMethod=test_update_course_enrollment>
mock_sailthru_api_post = <MagicMock name='api_post' id='140687767418192'>
mock_sailthru_api_get = <MagicMock name='api_get' id='140687827763384'>
mock_sailthru_purchase = <MagicMock name='purchase' id='140687763071160'>

    @patch('sailthru.sailthru_client.SailthruClient.purchase')
    @patch('sailthru.sailthru_client.SailthruClient.api_get')
    @patch('sailthru.sailthru_client.SailthruClient.api_post')
    def test_update_course_enrollment(self, mock_sailthru_api_post,
                                      mock_sailthru_api_get, mock_sailthru_purchase):
        """test update sailthru user record"""
    
        # create mocked Sailthru API responses
        mock_sailthru_api_post.return_value = MockSailthruResponse({'ok': True})
        mock_sailthru_api_get.return_value = MockSailthruResponse({'user': {"id": TEST_EMAIL, "fields": {"vars": 1}}})
        mock_sailthru_purchase.return_value = MockSailthruResponse({'ok': True})
        self.user.email = TEST_EMAIL
        CourseEnrollmentFactory(user=self.user, course_id=self.course_id)
        with patch('email_marketing.tasks.build_course_url') as m:
            m.return_value = self.course_url
            update_course_enrollment(TEST_EMAIL, self.course_id, 'audit')
        item = [{
            'vars': {'course_run_id': u'edX/toy/2012_Fall', 'mode': 'audit'},
            'url': self.course_url,
            'price': 0,
            'qty': 1,
            'id': 'edX/toy/2012_Fall-audit',
            'title': 'Course edX/toy/2012_Fall mode: audit'
        }]
>       mock_sailthru_purchase.assert_called_with(TEST_EMAIL, item, options={})

lms/djangoapps/email_marketing/tests/test_signals.py:644: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../edx-venv-3.5/edx-venv/lib/python3.5/site-packages/mock/mock.py:944: in assert_called_with
    six.raise_from(AssertionError(_error_message(cause)), cause)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

value = None, from_value = None

>   ???
E   AssertionError: expected call not found.
E   Expected: purchase('[email protected]', [{'id': 'edX/toy/2012_Fall-audit', 'url': 'http://lms.testserver.fake/courses/edX/toy/2012_Fall/info', 'price': 0, 'vars': {'course_run_id': 'edX/toy/2012_Fall', 'mode': 'audit'}, 'title': 'Course edX/toy/2012_Fall mode: audit', 'qty': 1}], options={})
E   Actual: purchase('[email protected]', [{'id': 'edX/toy/2012_Fall-audit', 'url': 'http://lms.testserver.fake/courses/edX/toy/2012_Fall/info', 'price': 0, 'vars': {'course_run_id': 'edX/toy/2012_Fall', 'mode': 'audit'}, 'title': 'Course edX/toy/2012_Fall mode: audit', 'qty': 1}], options={'send_template': 'enroll_template'})

<string>:3: AssertionError

Migrated from private ticket https://2u-internal.atlassian.net/issues/CR-1806

@timmc-edx timmc-edx added the flaky-test Details a test removed as part of the flaky test process label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flaky-test Details a test removed as part of the flaky test process
Projects
None yet
Development

No branches or pull requests

1 participant