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)
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
    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)
Exemplo n.º 4
0
    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)
Exemplo n.º 5
0
    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)
Exemplo n.º 6
0
    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)
Exemplo n.º 7
0
    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)