Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

fix: pass pytest common CertificateDashboardMessageDisplayTest #92

Closed
1 task
Carlos-Muniz opened this issue Sep 14, 2022 · 3 comments
Closed
1 task

Comments

@Carlos-Muniz
Copy link

Carlos-Muniz commented Sep 14, 2022

As part of #36, several tests have been discovered that are not passing in tutor, but passing in devstack. The following tests may not be run by tutor, or may be failing in tutor.

common/djangoapps/student/tests/test_certificates.py::CertificateDashboardMessageDisplayTest::

  • test_certificate_available_date_2___CertificatesDisplayBehaviors_END___end____False_
    • Removed because this test passes now
  • test_certificate_available_date_1___CertificatesDisplayBehaviors_END___end____True_

For more information about the tests that passed, failed, skipped, or never ran, see the spreadsheet with all the tests.

@Carlos-Muniz
Copy link
Author

After running common/djangoapps/student/tests/test_certificates.py::CertificateDashboardMessageDisplayTest tests again, the only failure was

FAILED common/djangoapps/student/tests/test_certificates.py::CertificateDashboardMessageDisplayTest::test_certificate_available_date_1___CertificatesDisplayBehaviors_END___end____True_

Here is the related pytest output:

================================================ FAILURES ================================================
_ CertificateDashboardMessageDisplayTest.test_certificate_available_date_1___CertificatesDisplayBehaviors_END___end____True_ _

self = <common.djangoapps.student.tests.test_certificates.CertificateDashboardMessageDisplayTest testMethod=test_certificate_available_date_1___CertificatesDisplayBehaviors_END___end____True_>
certificates_display_behavior = <CertificatesDisplayBehaviors.END: 'end'>, past_date = True

    @ddt.data(
        (CertificatesDisplayBehaviors.END, True),
        (CertificatesDisplayBehaviors.END, False),
        (CertificatesDisplayBehaviors.END_WITH_DATE, True),
        (CertificatesDisplayBehaviors.END_WITH_DATE, False)
    )
    @ddt.unpack
    def test_certificate_available_date(self, certificates_display_behavior, past_date):
        cert = self._create_certificate('verified')
        cert.status = CertificateStatuses.downloadable
        cert.save()

        self.course.certificates_display_behavior = certificates_display_behavior

        if certificates_display_behavior == CertificatesDisplayBehaviors.END:
            if past_date:
                self.course.end = PAST_DATE
            else:
                self.course.end = FUTURE_DATE
        if certificates_display_behavior == CertificatesDisplayBehaviors.END_WITH_DATE:
            if past_date:
                self.course.certificate_available_date = PAST_DATE
            else:
                self.course.certificate_available_date = FUTURE_DATE

        self.course.save()
        self.store.update_item(self.course, self.USERNAME)

>       self._check_message(PAST_DATE if past_date else FUTURE_DATE)

common/djangoapps/student/tests/test_certificates.py:137:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
common/djangoapps/student/tests/test_certificates.py:102: in _check_message
    self.assertNotContains(response, test_message)
../venv/lib/python3.8/site-packages/django/test/testcases.py:482: in assertNotContains
    self.assertEqual(real_count, 0, msg_prefix + "Response should not contain %s" % text_repr)
E   AssertionError: 1 != 0 : Response should not contain 'Your grade and certificate will be ready after'
------------------------------------------- Captured log call --------------------------------------------
ERROR    openedx.core.djangoapps.safe_sessions.middleware:middleware.py:179 SafeCookieData BWC parse error: 'wgjvbme3lemsc1qd3iszchp0q4nkn9ve'.

@Carlos-Muniz
Copy link
Author

Closing this issue because it fails for both Devstack and Tutor.

@Carlos-Muniz Carlos-Muniz closed this as not planned Won't fix, can't repro, duplicate, stale Dec 13, 2022
@Carlos-Muniz
Copy link
Author

This test does pass in tutor. See #155 for more details.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant