예제 #1
0
 def test_course_id(self):
     self.context['course_ids'] = ['foo/bar/baz']
     result_url = str(with_link_tracking(self.context, 'http://example.com/foo'))
     self.assert_query_string_parameters_equal(
         result_url,
         utm_term='foo/bar/baz',
     )
 def test_multiple_course_ids(self):
     self.context['course_ids'] = ['foo/bar/baz', 'course-v1:FooX+bar+baz']
     result_url = str(with_link_tracking(self.context, 'http://example.com/foo'))
     self.assert_query_string_parameters_equal(
         result_url,
         utm_term='foo/bar/baz',
     )
 def test_relative_url(self):
     result_url = str(with_link_tracking(self.context, '/foobar'))
     self.assert_url_components_equal(
         result_url,
         scheme='https',
         netloc='example.com',
         path='/foobar'
     )
예제 #4
0
 def test_relative_url(self):
     result_url = str(with_link_tracking(self.context, '/foobar'))
     self.assert_url_components_equal(
         result_url,
         scheme='https',
         netloc='example.com',
         path='/foobar'
     )
 def test_default(self):
     result_url = str(with_link_tracking(self.context, 'http://example.com/foo'))
     self.assert_url_components_equal(
         result_url,
         scheme='http',
         netloc='example.com',
         path='/foo',
         query='utm_source=test_app_label&utm_campaign=test_name&utm_medium=email&utm_content={uuid}'.format(
             uuid=self.message.uuid
         )
     )
예제 #6
0
 def test_default(self):
     result_url = str(with_link_tracking(self.context, 'http://example.com/foo'))
     self.assert_url_components_equal(
         result_url,
         scheme='http',
         netloc='example.com',
         path='/foo',
         query='utm_source=test_app_label&utm_campaign=test_name&utm_medium=email&utm_content={uuid}'.format(
             uuid=self.message.uuid
         )
     )
    def test_missing_message(self):
        del self.context['message']

        with self.assertRaises(VariableDoesNotExist):
            with_link_tracking(self.context, 'http://example.com/foo')
    def test_missing_request(self):
        self.mock_get_current_request.return_value = None

        with self.assertRaises(VariableDoesNotExist):
            with_link_tracking(self.context, 'http://example.com/foo')
예제 #9
0
    def test_missing_message(self):
        del self.context['message']

        with self.assertRaises(VariableDoesNotExist):
            with_link_tracking(self.context, 'http://example.com/foo')
예제 #10
0
    def test_missing_request(self):
        self.mock_get_current_request.return_value = None

        with self.assertRaises(VariableDoesNotExist):
            with_link_tracking(self.context, 'http://example.com/foo')