Skip to content

Commit fbf7e17

Browse files
committed
Fix the TestAutoUpgradeVersion0/1 methods
Don't hard-code a particular certificates to look for. Instead, look for a particular fingerprint.
1 parent d4cacb5 commit fbf7e17

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

UnitTests/Cryptography/SqliteCertificateDatabaseTests.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ public void TestAutoUpgradeVersion0 ()
8282
File.Copy (path, tmp);
8383

8484
using (var dbase = new SqliteCertificateDatabase (tmp, "no.secret")) {
85-
var root = chain[chain.Length - 1];
86-
8785
// Verify that we can select the Root Certificate
8886
bool trustedAnchor = false;
8987
foreach (var record in dbase.Find (null, true, X509CertificateRecordFields.Certificate)) {
90-
if (record.Certificate.Equals (root)) {
88+
var fingerprint = record.Certificate.GetFingerprint ();
89+
90+
if (fingerprint == "943471ff1ca3fb2dd843f515df261756cad58673") {
9191
trustedAnchor = true;
9292
break;
9393
}
@@ -109,12 +109,12 @@ public void TestAutoUpgradeVersion1 ()
109109
File.Copy (path, tmp);
110110

111111
using (var dbase = new SqliteCertificateDatabase (tmp, "no.secret")) {
112-
var root = chain[chain.Length - 1];
113-
114112
// Verify that we can select the Root Certificate
115113
bool trustedAnchor = false;
116114
foreach (var record in dbase.Find (null, true, X509CertificateRecordFields.Certificate)) {
117-
if (record.Certificate.Equals (root)) {
115+
var fingerprint = record.Certificate.GetFingerprint ();
116+
117+
if (fingerprint == "943471ff1ca3fb2dd843f515df261756cad58673") {
118118
trustedAnchor = true;
119119
break;
120120
}

0 commit comments

Comments
 (0)