Skip to content

Commit

Permalink
test: add/update test
Browse files Browse the repository at this point in the history
  • Loading branch information
mudassir-hafeez committed Jul 24, 2024
1 parent 1ebd3bf commit 148d281
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lms/djangoapps/instructor/tests/test_enrollment.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from common.djangoapps.student.models import CourseEnrollment, CourseEnrollmentAllowed, anonymous_id_for_user
from common.djangoapps.student.roles import CourseCcxCoachRole
from common.djangoapps.student.tests.factories import AdminFactory, UserFactory
from lms.djangoapps.branding.api import get_logo_url_for_email
from lms.djangoapps.ccx.tests.factories import CcxFactory
from lms.djangoapps.course_blocks.api import get_course_blocks
from lms.djangoapps.courseware.models import StudentModule
Expand Down Expand Up @@ -940,6 +941,7 @@ def setUpClass(cls):
)
cls.course_about_url = cls.course_url + 'about'
cls.registration_url = f'https://{site}/register'
cls.logo_url = get_logo_url_for_email()

def test_normal_params(self):
# For a normal site, what do we expect to get for the URLs?
Expand All @@ -950,6 +952,7 @@ def test_normal_params(self):
assert result['course_about_url'] == self.course_about_url
assert result['registration_url'] == self.registration_url
assert result['course_url'] == self.course_url
assert result['logo_url'] == self.logo_url

def test_marketing_params(self):
# For a site with a marketing front end, what do we expect to get for the URLs?
Expand All @@ -962,6 +965,19 @@ def test_marketing_params(self):
assert result['course_about_url'] is None
assert result['registration_url'] == self.registration_url
assert result['course_url'] == self.course_url
assert result['logo_url'] == self.logo_url

@patch('lms.djangoapps.instructor.enrollment.get_logo_url_for_email', return_value='https://www.logo.png')
def test_logo_url_params(self, mock_get_logo_url_for_email):
# Verify that the logo_url is correctly set in the email params
result = get_email_params(self.course, False)

assert result['auto_enroll'] is False
assert result['course_about_url'] == self.course_about_url
assert result['registration_url'] == self.registration_url
assert result['course_url'] == self.course_url
mock_get_logo_url_for_email.assert_called_once()
assert result['logo_url'] == 'https://www.logo.png'


@ddt.ddt
Expand Down

0 comments on commit 148d281

Please sign in to comment.