@@ -1723,6 +1723,12 @@ func TestHandler_RemoveX509Cert_BySubjectAndSKID(t *testing.T) {
1723
1723
require .Equal (t , 2 , len (allCerts [0 ].Certs )+ len (allCerts [1 ].Certs ))
1724
1724
_ , err = queryApprovedCertificates (setup , testconstants .IntermediateCertWithSameSubjectAndSKIDSubject , testconstants .IntermediateCertWithSameSubjectAndSKIDSubjectKeyID )
1725
1725
require .Equal (t , codes .NotFound , status .Code (err ))
1726
+ // check that unique certificates does not exists
1727
+ found := setup .Keeper .IsUniqueCertificatePresent (setup .Ctx , testconstants .RootCertWithSameSubjectAndSKIDSubject , testconstants .IntermediateCertWithSameSubjectAndSKID1SerialNumber )
1728
+ require .Equal (t , false , found )
1729
+ found = setup .Keeper .IsUniqueCertificatePresent (setup .Ctx , testconstants .RootCertWithSameSubjectAndSKIDSubject , testconstants .IntermediateCertWithSameSubjectAndSKID2SerialNumber )
1730
+ require .Equal (t , false , found )
1731
+
1726
1732
leafCerts , _ := queryApprovedCertificates (setup , testconstants .LeafCertWithSameSubjectAndSKIDSubject , testconstants .LeafCertWithSameSubjectAndSKIDSubjectKeyID )
1727
1733
require .Equal (t , 1 , len (leafCerts .Certs ))
1728
1734
require .Equal (t , testconstants .LeafCertWithSameSubjectAndSKIDSerialNumber , leafCerts .Certs [0 ].SerialNumber )
@@ -1796,6 +1802,12 @@ func TestHandler_RemoveX509Cert_BySerialNumber(t *testing.T) {
1796
1802
_ , err = queryApprovedCertificates (setup , testconstants .IntermediateCertWithSameSubjectAndSKIDSubject , testconstants .IntermediateCertWithSameSubjectAndSKIDSubjectKeyID )
1797
1803
require .Equal (t , codes .NotFound , status .Code (err ))
1798
1804
1805
+ // check that unique certificates does not exists
1806
+ found := setup .Keeper .IsUniqueCertificatePresent (setup .Ctx , testconstants .RootCertWithSameSubjectAndSKIDSubject , testconstants .IntermediateCertWithSameSubjectAndSKID1SerialNumber )
1807
+ require .Equal (t , false , found )
1808
+ found = setup .Keeper .IsUniqueCertificatePresent (setup .Ctx , testconstants .RootCertWithSameSubjectAndSKIDSubject , testconstants .IntermediateCertWithSameSubjectAndSKID2SerialNumber )
1809
+ require .Equal (t , false , found )
1810
+
1799
1811
leafCerts , _ = queryApprovedCertificates (setup , testconstants .LeafCertWithSameSubjectAndSKIDSubject , testconstants .LeafCertWithSameSubjectAndSKIDSubjectKeyID )
1800
1812
require .Equal (t , 1 , len (leafCerts .Certs ))
1801
1813
}
@@ -1862,6 +1874,12 @@ func TestHandler_RemoveX509Cert_RevokedAndApprovedCertificate(t *testing.T) {
1862
1874
require .Equal (t , codes .NotFound , status .Code (err ))
1863
1875
_ , err = queryRevokedCertificates (setup , testconstants .IntermediateCertWithSameSubjectAndSKIDSubject , testconstants .IntermediateCertWithSameSubjectAndSKIDSubjectKeyID )
1864
1876
require .Equal (t , codes .NotFound , status .Code (err ))
1877
+
1878
+ // check that unique certificates does not exists
1879
+ found := setup .Keeper .IsUniqueCertificatePresent (setup .Ctx , testconstants .RootCertWithSameSubjectAndSKIDSubject , testconstants .IntermediateCertWithSameSubjectAndSKID1SerialNumber )
1880
+ require .Equal (t , false , found )
1881
+ found = setup .Keeper .IsUniqueCertificatePresent (setup .Ctx , testconstants .RootCertWithSameSubjectAndSKIDSubject , testconstants .IntermediateCertWithSameSubjectAndSKID2SerialNumber )
1882
+ require .Equal (t , false , found )
1865
1883
}
1866
1884
1867
1885
func TestHandler_RemoveX509Cert_RevokedCertificate (t * testing.T ) {
@@ -1923,6 +1941,10 @@ func TestHandler_RemoveX509Cert_RevokedCertificate(t *testing.T) {
1923
1941
require .Equal (t , codes .NotFound , status .Code (err ))
1924
1942
_ , err = queryRevokedCertificates (setup , testconstants .IntermediateSubject , testconstants .IntermediateSubjectKeyID )
1925
1943
require .Equal (t , codes .NotFound , status .Code (err ))
1944
+
1945
+ // check that unique certificate does not exists
1946
+ found := setup .Keeper .IsUniqueCertificatePresent (setup .Ctx , testconstants .IntermediateIssuer , testconstants .IntermediateSerialNumber )
1947
+ require .Equal (t , false , found )
1926
1948
}
1927
1949
1928
1950
func TestHandler_RemoveX509Cert_CertificateDoesNotExist (t * testing.T ) {
0 commit comments