Ejemplo n.º 1
0
    def test_mailhide_helper(self):
        """Test mailhide helper."""
        m1 = Markup(u'<a href="http://mailhide.recaptcha.net/d?k=01Ni54q--g1yl'
                    'tekhaSmPYHQ==&c=3m5HgumLI4YSLSY-YP9HQA==" onclick="window'
                    '.open(\'http://mailhide.recaptcha.net/d?k=01Ni54q--g1ylte'
                    'khaSmPYHQ==&c=3m5HgumLI4YSLSY-YP9HQA==\', \'\', \'toolbar'
                    '=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizabl'
                    'e=0,width=500,height=300\'); return false;" title="Reveal'
                    ' this e-mail address">[email protected]</a>')

        m2 = Markup(u'<a href="http://mailhide.recaptcha.net/d?k=01Ni54q--g1yl'
                    'tekhaSmPYHQ==&c=9o38o8PEvGrP6V5HSDg_FA==" onclick="window'
                    '.open(\'http://mailhide.recaptcha.net/d?k=01Ni54q--g1ylte'
                    'khaSmPYHQ==&c=9o38o8PEvGrP6V5HSDg_FA==\', \'\', \'toolbar'
                    '=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizabl'
                    'e=0,width=500,height=300\'); return false;" title="Reveal'
                    ' this e-mail address">[email protected]</a>')

        m3 = Markup(u'<a href="http://mailhide.recaptcha.net/d?k=01Ni54q--g1yl'
                    'tekhaSmPYHQ==&c=ABBkk5Aj2-PJ_izt9yU8pMztwm-96eABHLBt8jRXx'
                    'ak=" onclick="window.open(\'http://mailhide.recaptcha.net'
                    '/d?k=01Ni54q--g1yltekhaSmPYHQ==&c=ABBkk5Aj2-PJ_izt9yU8pMz'
                    'twm-96eABHLBt8jRXxak=\', \'\', \'toolbar=0,scrollbars=0,l'
                    'ocation=0,statusbar=0,menubar=0,resizable=0,width=500,hei'
                    'ght=300\'); return false;" title="Reveal this e-mail addr'
                    'ess">[email protected]</a>')

        test_strings = [('*****@*****.**', m1),
                        ('*****@*****.**', m2),
                        ('*****@*****.**', m3)]

        for string, markup in test_strings:
            eq_(mailhide(string), markup)
Ejemplo n.º 2
0
    def test_mailhide_helper(self):
        """Test mailhide helper."""
        if getattr(settings, "MAILHIDE_PUB_KEY", None) != "01Ni54q--g1yltekhaSmPYHQ==":
            raise SkipTest("Skipping test due to different MailHide pub key.")

        m1 = Markup(
            u'<a href="http://mailhide.recaptcha.net/d?k=01Ni54q--g1yl'
            'tekhaSmPYHQ==&c=3m5HgumLI4YSLSY-YP9HQA==" onclick="window'
            ".open('http://mailhide.recaptcha.net/d?k=01Ni54q--g1ylte"
            "khaSmPYHQ==&c=3m5HgumLI4YSLSY-YP9HQA==', '', 'toolbar"
            "=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizabl"
            'e=0,width=500,height=300\'); return false;" title="Reveal'
            ' this e-mail address">[email protected]</a>'
        )

        m2 = Markup(
            u'<a href="http://mailhide.recaptcha.net/d?k=01Ni54q--g1yl'
            'tekhaSmPYHQ==&c=9o38o8PEvGrP6V5HSDg_FA==" onclick="window'
            ".open('http://mailhide.recaptcha.net/d?k=01Ni54q--g1ylte"
            "khaSmPYHQ==&c=9o38o8PEvGrP6V5HSDg_FA==', '', 'toolbar"
            "=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizabl"
            'e=0,width=500,height=300\'); return false;" title="Reveal'
            ' this e-mail address">[email protected]</a>'
        )

        m3 = Markup(
            u'<a href="http://mailhide.recaptcha.net/d?k=01Ni54q--g1yl'
            "tekhaSmPYHQ==&c=ABBkk5Aj2-PJ_izt9yU8pMztwm-96eABHLBt8jRXx"
            'ak=" onclick="window.open(\'http://mailhide.recaptcha.net'
            "/d?k=01Ni54q--g1yltekhaSmPYHQ==&c=ABBkk5Aj2-PJ_izt9yU8pMz"
            "twm-96eABHLBt8jRXxak=', '', 'toolbar=0,scrollbars=0,l"
            "ocation=0,statusbar=0,menubar=0,resizable=0,width=500,hei"
            'ght=300\'); return false;" title="Reveal this e-mail addr'
            'ess">[email protected]</a>'
        )

        test_strings = [("*****@*****.**", m1), ("*****@*****.**", m2), ("*****@*****.**", m3)]

        for string, markup in test_strings:
            eq_(mailhide(string), markup)
Ejemplo n.º 3
0
    def test_mailhide_helper(self):
        """Test mailhide helper."""
        if (getattr(settings, 'MAILHIDE_PUB_KEY', None) !=
                '01Ni54q--g1yltekhaSmPYHQ=='):
            raise SkipTest('Skipping test due to different MailHide pub key.')

        m1 = Markup(u'<a href="http://mailhide.recaptcha.net/d?k=01Ni54q--g1yl'
                    'tekhaSmPYHQ==&c=3m5HgumLI4YSLSY-YP9HQA==" onclick="window'
                    '.open(\'http://mailhide.recaptcha.net/d?k=01Ni54q--g1ylte'
                    'khaSmPYHQ==&c=3m5HgumLI4YSLSY-YP9HQA==\', \'\', \'toolbar'
                    '=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizabl'
                    'e=0,width=500,height=300\'); return false;" title="Reveal'
                    ' this e-mail address">[email protected]</a>')

        m2 = Markup(u'<a href="http://mailhide.recaptcha.net/d?k=01Ni54q--g1yl'
                    'tekhaSmPYHQ==&c=9o38o8PEvGrP6V5HSDg_FA==" onclick="window'
                    '.open(\'http://mailhide.recaptcha.net/d?k=01Ni54q--g1ylte'
                    'khaSmPYHQ==&c=9o38o8PEvGrP6V5HSDg_FA==\', \'\', \'toolbar'
                    '=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizabl'
                    'e=0,width=500,height=300\'); return false;" title="Reveal'
                    ' this e-mail address">[email protected]</a>')

        m3 = Markup(u'<a href="http://mailhide.recaptcha.net/d?k=01Ni54q--g1yl'
                    'tekhaSmPYHQ==&c=ABBkk5Aj2-PJ_izt9yU8pMztwm-96eABHLBt8jRXx'
                    'ak=" onclick="window.open(\'http://mailhide.recaptcha.net'
                    '/d?k=01Ni54q--g1yltekhaSmPYHQ==&c=ABBkk5Aj2-PJ_izt9yU8pMz'
                    'twm-96eABHLBt8jRXxak=\', \'\', \'toolbar=0,scrollbars=0,l'
                    'ocation=0,statusbar=0,menubar=0,resizable=0,width=500,hei'
                    'ght=300\'); return false;" title="Reveal this e-mail addr'
                    'ess">[email protected]</a>')

        test_strings = [('*****@*****.**', m1),
                        ('*****@*****.**', m2),
                        ('*****@*****.**', m3)]

        for string, markup in test_strings:
            eq_(mailhide(string), markup)