@@ -709,6 +709,40 @@ func TestAccountMapping(t *testing.T) { // don't block encoding!!!
709
709
}
710
710
}
711
711
712
+ func TestAccountClusterMany100MappingOK (t * testing.T ) { // don't block encoding!!!
713
+ akp := createAccountNKey (t )
714
+ apk := publicKey (akp , t )
715
+
716
+ account := NewAccountClaims (apk )
717
+ vr := & ValidationResults {}
718
+
719
+ account .AddMapping ("q" ,
720
+ WeightedMapping {Subject : "qq" , Weight : 100 , Cluster : "A" },
721
+ WeightedMapping {Subject : "qq" , Weight : 100 , Cluster : "B" },
722
+ WeightedMapping {Subject : "bb" , Weight : 100 , Cluster : "C" },
723
+ WeightedMapping {Subject : "qq" , Weight : 100 })
724
+ account .Validate (vr )
725
+ if ! vr .IsEmpty () {
726
+ t .Fatal ("Expected no errors" )
727
+ }
728
+ }
729
+
730
+ func TestAccountClusterNoOver100Mapping (t * testing.T ) { // don't block encoding!!!
731
+ akp := createAccountNKey (t )
732
+ apk := publicKey (akp , t )
733
+
734
+ account := NewAccountClaims (apk )
735
+ vr := & ValidationResults {}
736
+
737
+ account .AddMapping ("q" ,
738
+ WeightedMapping {Subject : "qq" , Weight : 100 , Cluster : "A" },
739
+ WeightedMapping {Subject : "qq" , Weight : 5 , Cluster : "A" })
740
+ account .Validate (vr )
741
+ if ! vr .IsBlocking (false ) {
742
+ t .Fatal ("Expected blocking error as sum of weights is > 100" )
743
+ }
744
+ }
745
+
712
746
func TestAccountExternalAuthorization (t * testing.T ) {
713
747
akp := createAccountNKey (t )
714
748
apk := publicKey (akp , t )
0 commit comments