diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/firefox-ui/tests/puppeteer/test_security.py | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/firefox-ui/tests/puppeteer/test_security.py')
-rw-r--r-- | testing/firefox-ui/tests/puppeteer/test_security.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/testing/firefox-ui/tests/puppeteer/test_security.py b/testing/firefox-ui/tests/puppeteer/test_security.py new file mode 100644 index 000000000..879053e5a --- /dev/null +++ b/testing/firefox-ui/tests/puppeteer/test_security.py @@ -0,0 +1,45 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +from firefox_puppeteer import PuppeteerMixin +from firefox_puppeteer.errors import NoCertificateError +from marionette_harness import MarionetteTestCase + + +class TestSecurity(PuppeteerMixin, MarionetteTestCase): + + def test_get_address_from_certificate(self): + url = 'https://ssl-ev.mozqa.com' + + with self.marionette.using_context(self.marionette.CONTEXT_CONTENT): + self.marionette.navigate(url) + + cert = self.browser.tabbar.tabs[0].certificate + self.assertIn(cert['commonName'], url) + self.assertEqual(cert['organization'], 'Mozilla Corporation') + self.assertEqual(cert['issuerOrganization'], 'DigiCert Inc') + + address = self.puppeteer.security.get_address_from_certificate(cert) + self.assertIsNotNone(address) + self.assertIsNotNone(address['city']) + self.assertIsNotNone(address['country']) + self.assertIsNotNone(address['postal_code']) + self.assertIsNotNone(address['state']) + self.assertIsNotNone(address['street']) + + def test_get_certificate(self): + url_http = self.marionette.absolute_url('layout/mozilla.html') + url_https = 'https://ssl-ev.mozqa.com' + + # Test EV certificate + with self.marionette.using_context(self.marionette.CONTEXT_CONTENT): + self.marionette.navigate(url_https) + cert = self.browser.tabbar.tabs[0].certificate + self.assertIn(cert['commonName'], url_https) + + # HTTP connections do not have a SSL certificate + with self.marionette.using_context(self.marionette.CONTEXT_CONTENT): + self.marionette.navigate(url_http) + with self.assertRaises(NoCertificateError): + self.browser.tabbar.tabs[0].certificate |