@@ -1824,6 +1824,96 @@ func TestHandler_RevocationPointsByIssuerSubjectKeyID(t *testing.T) {
1824
1824
require .Equal (t , len (revocationPointBySubjectKeyID .Points ), 1 )
1825
1825
}
1826
1826
1827
+ func TestHandler_AddRevocationPointForSameCertificateWithDifferentWhitespaces (t * testing.T ) {
1828
+ setup := Setup (t )
1829
+
1830
+ vendorAcc := GenerateAccAddress ()
1831
+ setup .AddAccount (vendorAcc , []dclauthtypes.AccountRole {dclauthtypes .Vendor }, 65521 )
1832
+
1833
+ // propose x509 root certificate by account Trustee1
1834
+ proposeAddX509RootCert := types .NewMsgProposeAddX509RootCert (setup .Trustee1 .String (), testconstants .PAACertWithNumericVid , testconstants .Info , testconstants .Vid , testconstants .CertSchemaVersion )
1835
+ _ , err := setup .Handler (setup .Ctx , proposeAddX509RootCert )
1836
+ require .NoError (t , err )
1837
+
1838
+ // approve
1839
+ approveAddX509RootCert := types .NewMsgApproveAddX509RootCert (
1840
+ setup .Trustee2 .String (), testconstants .PAACertWithNumericVidSubject , testconstants .PAACertWithNumericVidSubjectKeyID , testconstants .Info )
1841
+ _ , err = setup .Handler (setup .Ctx , approveAddX509RootCert )
1842
+ require .NoError (t , err )
1843
+
1844
+ addPkiRevocationDistributionPoint := types.MsgAddPkiRevocationDistributionPoint {
1845
+ Signer : vendorAcc .String (),
1846
+ Vid : testconstants .PAACertWithNumericVidVid ,
1847
+ IsPAA : true ,
1848
+ Pid : 8 ,
1849
+ CrlSignerCertificate : testconstants .PAACertWithNumericVidDifferentWhitespaces ,
1850
+ Label : "label" ,
1851
+ DataURL : testconstants .DataURL + "/1" ,
1852
+ IssuerSubjectKeyID : testconstants .SubjectKeyIDWithoutColons ,
1853
+ RevocationType : 1 ,
1854
+ }
1855
+ _ , err = setup .Handler (setup .Ctx , & addPkiRevocationDistributionPoint )
1856
+ require .NoError (t , err )
1857
+
1858
+ revocationPointBySubjectKeyID , isFound := setup .Keeper .GetPkiRevocationDistributionPointsByIssuerSubjectKeyID (setup .Ctx , testconstants .SubjectKeyIDWithoutColons )
1859
+ require .True (t , isFound )
1860
+ require .Equal (t , len (revocationPointBySubjectKeyID .Points ), 1 )
1861
+ require .Equal (t , revocationPointBySubjectKeyID .Points [0 ].CrlSignerCertificate , addPkiRevocationDistributionPoint .CrlSignerCertificate )
1862
+ }
1863
+
1864
+ func TestHandler_UpdateRevocationPointForSameCertificateWithDifferentWhitespaces (t * testing.T ) {
1865
+ setup := Setup (t )
1866
+
1867
+ vendorAcc := GenerateAccAddress ()
1868
+ setup .AddAccount (vendorAcc , []dclauthtypes.AccountRole {dclauthtypes .Vendor }, 65521 )
1869
+
1870
+ // propose x509 root certificate by account Trustee1
1871
+ proposeAddX509RootCert := types .NewMsgProposeAddX509RootCert (setup .Trustee1 .String (), testconstants .PAACertWithNumericVid , testconstants .Info , testconstants .Vid , testconstants .CertSchemaVersion )
1872
+ _ , err := setup .Handler (setup .Ctx , proposeAddX509RootCert )
1873
+ require .NoError (t , err )
1874
+
1875
+ // approve
1876
+ approveAddX509RootCert := types .NewMsgApproveAddX509RootCert (
1877
+ setup .Trustee2 .String (), testconstants .PAACertWithNumericVidSubject , testconstants .PAACertWithNumericVidSubjectKeyID , testconstants .Info )
1878
+ _ , err = setup .Handler (setup .Ctx , approveAddX509RootCert )
1879
+ require .NoError (t , err )
1880
+
1881
+ addPkiRevocationDistributionPoint := types.MsgAddPkiRevocationDistributionPoint {
1882
+ Signer : vendorAcc .String (),
1883
+ Vid : testconstants .PAACertWithNumericVidVid ,
1884
+ IsPAA : true ,
1885
+ Pid : 8 ,
1886
+ CrlSignerCertificate : testconstants .PAACertWithNumericVid ,
1887
+ Label : "label" ,
1888
+ DataURL : testconstants .DataURL + "/1" ,
1889
+ IssuerSubjectKeyID : testconstants .SubjectKeyIDWithoutColons ,
1890
+ RevocationType : 1 ,
1891
+ }
1892
+ _ , err = setup .Handler (setup .Ctx , & addPkiRevocationDistributionPoint )
1893
+ require .NoError (t , err )
1894
+
1895
+ revocationPointBySubjectKeyID , isFound := setup .Keeper .GetPkiRevocationDistributionPointsByIssuerSubjectKeyID (setup .Ctx , testconstants .SubjectKeyIDWithoutColons )
1896
+ require .True (t , isFound )
1897
+ require .Equal (t , len (revocationPointBySubjectKeyID .Points ), 1 )
1898
+
1899
+ dataURLNew := testconstants .DataURL + "/new"
1900
+ updatePkiRevocationDistributionPoint := types.MsgUpdatePkiRevocationDistributionPoint {
1901
+ Signer : vendorAcc .String (),
1902
+ Vid : testconstants .PAACertWithNumericVidVid ,
1903
+ CrlSignerCertificate : testconstants .PAACertWithNumericVidDifferentWhitespaces ,
1904
+ Label : "label" ,
1905
+ DataURL : dataURLNew ,
1906
+ IssuerSubjectKeyID : testconstants .SubjectKeyIDWithoutColons ,
1907
+ }
1908
+ _ , err = setup .Handler (setup .Ctx , & updatePkiRevocationDistributionPoint )
1909
+ require .NoError (t , err )
1910
+
1911
+ revocationPointBySubjectKeyID , isFound = setup .Keeper .GetPkiRevocationDistributionPointsByIssuerSubjectKeyID (setup .Ctx , testconstants .SubjectKeyIDWithoutColons )
1912
+ require .True (t , isFound )
1913
+ require .Equal (t , revocationPointBySubjectKeyID .Points [0 ].CrlSignerCertificate , updatePkiRevocationDistributionPoint .CrlSignerCertificate )
1914
+ require .Equal (t , revocationPointBySubjectKeyID .Points [0 ].DataURL , updatePkiRevocationDistributionPoint .DataURL )
1915
+ }
1916
+
1827
1917
func TestHandler_AssignVid_SenderNotVendorAdmin (t * testing.T ) {
1828
1918
setup := Setup (t )
1829
1919
0 commit comments