@override_settings(ORIGIN='https://connect.local')
    @patch('open_connect.mailer.templatetags.mailing.generate_code')
    @patch('open_connect.mailer.templatetags.mailing.now')
    @patch('open_connect.mailer.templatetags.mailing.url_representation_encode')
    def test_tracking_pixel(self, mock_url_rep, mock_now, mock_generate_code):
        mock_url_rep.return_value = ('VerifiedDataHere', 'HashIsHere')
        mock_generate_code.return_value = 'uLSbgASwWk'
        mock_now().replace(
            ).isoformat.return_value = '2014-04-07 17:01:12+00:00'

        result = tracking_pixel('me@razzmatazz.local', '10')
        mock_url_rep.assert_called_once_with(OPEN_DATA)

        gif_url = reverse(
            'email_open',
            kwargs={
                'encoded_data': 'VerifiedDataHere',
                'request_hash': 'HashIsHere'
            }
        )
        pixel_code = ('<img src="{origin}{gif}" width="1" height="1"'
                      ' border="0">').format(origin='https://connect.local',
                                             gif=gif_url)

        self.assertIn(pixel_code, result)
Test for tracking pixel
dataset/ETHPy150Open ofa/connect/open_connect/mailer/tests/test_templatetags.py/TestTrackingPixel.test_tracking_pixel