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

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

Issue 2841533003: Roll WPR to the lastest commit (Closed)
Patch Set: update Created 3 years, 7 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
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_version())
133 self.assertEqual(2, cert.get_extension_count())
134 self.assertEqual(b"subjectAltName", cert.get_extension(0).get_short_name())
135 self.assertEqual(b"extendedKeyUsage",
136 cert.get_extension(1).get_short_name())
137
132 138
133 139
134 if __name__ == '__main__': 140 if __name__ == '__main__':
135 unittest.main() 141 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698