本文整理汇总了Python中student.models.LinkedInAddToProfileConfiguration.add_to_profile_url方法的典型用法代码示例。如果您正苦于以下问题:Python LinkedInAddToProfileConfiguration.add_to_profile_url方法的具体用法?Python LinkedInAddToProfileConfiguration.add_to_profile_url怎么用?Python LinkedInAddToProfileConfiguration.add_to_profile_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类student.models.LinkedInAddToProfileConfiguration
的用法示例。
在下文中一共展示了LinkedInAddToProfileConfiguration.add_to_profile_url方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_linked_in_url_with_cert_name_override
# 需要导入模块: from student.models import LinkedInAddToProfileConfiguration [as 别名]
# 或者: from student.models.LinkedInAddToProfileConfiguration import add_to_profile_url [as 别名]
def test_linked_in_url_with_cert_name_override(self, cert_mode, expected_cert_name):
config = LinkedInAddToProfileConfiguration(
company_identifier='0_mC_o2MizqdtZEmkVXjH4eYwMj4DnkCWrZP_D9',
enabled=True
)
expected_url = (
'http://www.linkedin.com/profile/add'
'?_ed=0_mC_o2MizqdtZEmkVXjH4eYwMj4DnkCWrZP_D9&'
'pfCertificationName={platform_name}+{expected_cert_name}&'
'pfCertificationUrl=http%3A%2F%2Fs3.edx%2Fcert&'
'source=o'
).format(
expected_cert_name=expected_cert_name,
platform_name=quote(settings.PLATFORM_NAME.encode('utf-8'))
)
with with_site_configuration_context(configuration=self.SITE_CONFIGURATION):
actual_url = config.add_to_profile_url(
self.COURSE_KEY,
self.COURSE_NAME,
cert_mode,
self.CERT_URL
)
self.assertEqual(actual_url, expected_url)
示例2: test_linked_in_url_tracking_code
# 需要导入模块: from student.models import LinkedInAddToProfileConfiguration [as 别名]
# 或者: from student.models.LinkedInAddToProfileConfiguration import add_to_profile_url [as 别名]
def test_linked_in_url_tracking_code(self):
config = LinkedInAddToProfileConfiguration(company_identifier="abcd123", trk_partner_name="edx", enabled=True)
expected_param = urlencode({"trk": u"edx-{course_key}_honor-dashboard".format(course_key=self.COURSE_KEY)})
actual_url = config.add_to_profile_url(self.COURSE_KEY, self.COURSE_NAME, "honor", self.CERT_URL)
self.assertIn(expected_param, actual_url)
示例3: test_linked_in_url
# 需要导入模块: from student.models import LinkedInAddToProfileConfiguration [as 别名]
# 或者: from student.models.LinkedInAddToProfileConfiguration import add_to_profile_url [as 别名]
def test_linked_in_url(self, cert_mode, expected_cert_name):
config = LinkedInAddToProfileConfiguration(
company_identifier="0_mC_o2MizqdtZEmkVXjH4eYwMj4DnkCWrZP_D9", enabled=True
)
expected_url = (
"http://www.linkedin.com/profile/add"
"?_ed=0_mC_o2MizqdtZEmkVXjH4eYwMj4DnkCWrZP_D9&"
"pfCertificationName={platform_name}+{expected_cert_name}&"
"pfCertificationUrl=http%3A%2F%2Fs3.edx%2Fcert&"
"source=o"
).format(expected_cert_name=expected_cert_name, platform_name=quote(settings.PLATFORM_NAME.encode("utf-8")))
actual_url = config.add_to_profile_url(self.COURSE_KEY, self.COURSE_NAME, cert_mode, self.CERT_URL)
self.assertEqual(actual_url, expected_url)
示例4: test_linked_in_url
# 需要导入模块: from student.models import LinkedInAddToProfileConfiguration [as 别名]
# 或者: from student.models.LinkedInAddToProfileConfiguration import add_to_profile_url [as 别名]
def test_linked_in_url(self, cert_mode, expected_cert_name):
config = LinkedInAddToProfileConfiguration(
company_identifier='0_mC_o2MizqdtZEmkVXjH4eYwMj4DnkCWrZP_D9',
enabled=True
)
expected_url = (
'http://www.linkedin.com/profile/add'
'?_ed=0_mC_o2MizqdtZEmkVXjH4eYwMj4DnkCWrZP_D9&'
'pfCertificationName={expected_cert_name}&'
'pfCertificationUrl=http%3A%2F%2Fs3.edx%2Fcert&'
'source=o'
).format(expected_cert_name=expected_cert_name)
actual_url = config.add_to_profile_url(
self.COURSE_KEY,
self.COURSE_NAME,
cert_mode,
self.CERT_URL
)
self.assertEqual(actual_url, expected_url)