Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: telemetry/third_party/web-page-replay/certutils_test.py

Issue 2811373002: [web-page-replay] Roll WPR to the latest commit (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « telemetry/third_party/web-page-replay/certutils.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 Google Inc. All Rights Reserved. 1 # Copyright 2014 Google Inc. All Rights Reserved.
2 # 2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); 3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License. 4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at 5 # You may obtain a copy of the License at
6 # 6 #
7 # http://www.apache.org/licenses/LICENSE-2.0 7 # http://www.apache.org/licenses/LICENSE-2.0
8 # 8 #
9 # Unless required by applicable law or agreed to in writing, software 9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, 10 # distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 subject = 'testSubject' 118 subject = 'testSubject'
119 cert_string = certutils.generate_cert( 119 cert_string = certutils.generate_cert(
120 root_string, '', subject) 120 root_string, '', subject)
121 cert = certutils.load_cert(cert_string) 121 cert = certutils.load_cert(cert_string)
122 self.assertEqual(issuer, cert.get_issuer().commonName) 122 self.assertEqual(issuer, cert.get_issuer().commonName)
123 self.assertEqual(subject, cert.get_subject().commonName) 123 self.assertEqual(subject, cert.get_subject().commonName)
124 124
125 with open(ca_cert_path, 'r') as ca_cert_file: 125 with open(ca_cert_path, 'r') as ca_cert_file:
126 ca_cert_str = ca_cert_file.read() 126 ca_cert_str = ca_cert_file.read()
127 cert_string = certutils.generate_cert(ca_cert_str, cert_string, 127 cert_string = certutils.generate_cert(ca_cert_str, cert_string,
128 'host') 128 'host.com')
129 cert = certutils.load_cert(cert_string) 129 cert = certutils.load_cert(cert_string)
130 self.assertEqual(issuer, cert.get_issuer().commonName) 130 self.assertEqual(issuer, cert.get_issuer().commonName)
131 self.assertEqual(subject, cert.get_subject().commonName) 131 self.assertEqual(subject, cert.get_subject().commonName)
132 self.assertEqual(2, cert.get_extension_count())
133 self.assertEqual(b"subjectAltName", cert.get_extension(0).get_short_name())
134 self.assertEqual(b"extendedKeyUsage",
135 cert.get_extension(1).get_short_name())
136
132 137
133 138
134 if __name__ == '__main__': 139 if __name__ == '__main__':
135 unittest.main() 140 unittest.main()
OLDNEW
« no previous file with comments | « telemetry/third_party/web-page-replay/certutils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698