Bug 234856: add automated test case (fixed by bug 235230). r=kaie

This commit is contained in:
Zack Weinberg 2014-07-04 12:22:32 -04:00
parent 1bb2ec903f
commit 32d9c9ea16
2 changed files with 47 additions and 0 deletions

View File

@ -1,5 +1,6 @@
[DEFAULT]
[test_bug234856.html]
[test_bug413909.html]
[test_bug480619.html]
[test_bug644006.html]

View File

@ -0,0 +1,46 @@
<!doctype html>
<html><head>
<meta charset="utf-8">
<title>Test for Bug 234856</title>
<script src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"
></script>
<link rel="stylesheet"
href="chrome://mochikit/content/tests/SimpleTest/test.css">
</head><body>
<script>
const Ci = Components.interfaces;
SimpleTest.waitForExplicitFinish();
window.onload = function RunTest()
{
var certDB = Components.classes["@mozilla.org/security/x509certdb;1"]
.getService(Ci.nsIX509CertDB);
var rawCert = document.getElementById("cert").firstChild.wholeText;
var cert = certDB.constructX509FromBase64(rawCert);
// all simple attributes that are properties of the cert itself
is(cert.certType, Ci.nsIX509Cert.EMAIL_CERT, "certType");
is(cert.isSelfSigned, false, "isSelfSigned");
is(cert.serialNumber, "00:98:99:6F", "serialNumber");
is(cert.sha1Fingerprint, "03:E2:EB:66:DC:D3:44:10:F5:FE:9E:C7:8D:51:3C:BF:9A:AD:7C:5E", "sha1Fingerprint");
is(cert.sha256Fingerprint, "A5:CE:5B:9C:F1:56:3D:D6:8D:03:C5:A0:6C:9E:D3:10:01:B3:81:C9:CF:21:5F:E4:D2:D4:A9:73:C4:8C:9E:30", "sha256Fingerprint");
is(cert.nickname, "(no nickname)", "nickname");
is(cert.emailAddress, "ludek.rasek@centrum.cz", "emailAddress");
is(cert.subjectName, "serialNumber=ICA - 10003769,SN=Rašek,name=Luděk Rašek,initials=LR,givenName=Luděk,E=ludek.rasek@centrum.cz,L=\"Pacov, Nádražní 769\",ST=Vysočina,CN=Luděk Rašek,C=CZ", "subjectName");
is(cert.commonName, "Luděk Rašek", "commonName");
is(cert.organization, "", "organization");
is(cert.organizationalUnit, "", "organizationalUnit");
is(cert.windowTitle, "Luděk Rašek", "windowTitle");
is(cert.issuerName, "OU=Akreditovaný poskytovatel certifikačních služeb,O=První certifikační autorita a.s.,L=\"Podvinný mlýn 2178/6, 190 00 Praha 9\",C=CZ,CN=I.CA - Qualified root certificate (kvalifikovaný certifikát poskytovatele) - PSEUDONYM", "issuerName");
is(cert.issuerCommonName, "I.CA - Qualified root certificate (kvalifikovaný certifikát poskytovatele) - PSEUDONYM", "issuerCommonName");
is(cert.issuerOrganization, "První certifikační autorita a.s.", "issuerOrganization");
is(cert.issuerOrganizationUnit, "Akreditovaný poskytovatel certifikačních služeb", "issuerOrganizationUnit");
SimpleTest.finish();
}
</script>
<div style="display:none" id="cert">MIIF3DCCBMSgAwIBAgIEAJiZbzANBgkqhkiG9w0BAQUFADCCAQ0xYTBfBgNVBAMMWEkuQ0EgLSBRdWFsaWZpZWQgcm9vdCBjZXJ0aWZpY2F0ZSAoa3ZhbGlmaWtvdmFuw70gY2VydGlmaWvDoXQgcG9za3l0b3ZhdGVsZSkgLSBQU0VVRE9OWU0xCzAJBgNVBAYTAkNaMS8wLQYDVQQHDCZQb2R2aW5uw70gbWzDvW4gMjE3OC82LCAxOTAgMDAgUHJhaGEgOTEsMCoGA1UECgwjUHJ2bsOtIGNlcnRpZmlrYcSNbsOtIGF1dG9yaXRhIGEucy4xPDA6BgNVBAsMM0FrcmVkaXRvdmFuw70gcG9za3l0b3ZhdGVsIGNlcnRpZmlrYcSNbsOtY2ggc2x1xb5lYjAeFw0wMjEyMTIxMzMzNDZaFw0wMzEyMTIxMzMzNDZaMIIBFDELMAkGA1UEBhMCQ1oxHzAdBgNVBAMeFgBMAHUAZAEbAGsAIABSAGEBYQBlAGsxGTAXBgNVBAgeEABWAHkAcwBvAQ0AaQBuAGExLzAtBgNVBAceJgBQAGEAYwBvAHYALAAgAE4A4QBkAHIAYQF+AG4A7QAgADcANgA5MSUwIwYJKoZIhv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