GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Unverified Commit 59782207 authored by boklm's avatar boklm
Browse files

Bug 20149: add public key pinning test

parent 76acd0bc
......@@ -438,6 +438,13 @@ our @tests = (
descr => 'Check if download of PDF is working (#19402)',
use_net => 1,
},
{
name => 'pinning_now',
type => 'marionette',
descr => 'Check if static public key pinning is working (#20149)',
marionette_test => 'pinning',
use_net => 1,
},
);
sub toggle_https_everywhere {
......
from marionette_driver import By, Actions
from marionette_driver.errors import MarionetteException, JavascriptException
from marionette import MarionetteTestCase
import testsuite
class Test(MarionetteTestCase):
def setUp(self):
MarionetteTestCase.setUp(self)
ts = testsuite.TestSuite()
self.ts = ts
self.URL = 'https://pinning-test.badssl.com/'
def test_pinning(self):
m = self.marionette
with m.using_context('content'):
res = False
try:
m.navigate(self.URL)
except Exception:
res = True
self.assertTrue(res, msg="Page could be loaded")
if res:
errorCode = m.find_element('id', 'errorCode')
self.assertEqual(errorCode.get_attribute('title'),
'MOZILLA_PKIX_ERROR_KEY_PINNING_FAILURE',
msg='Wrong error code')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment