github.com/letsencrypt/boulder@v0.20251208.0/sa/satest/satest.go (about) 1 package satest 2 3 import ( 4 "context" 5 "testing" 6 "time" 7 8 "google.golang.org/protobuf/types/known/timestamppb" 9 10 "github.com/letsencrypt/boulder/core" 11 corepb "github.com/letsencrypt/boulder/core/proto" 12 sapb "github.com/letsencrypt/boulder/sa/proto" 13 ) 14 15 // CreateWorkingRegistration inserts a new, correct Registration into 16 // SA using GoodKey under the hood. This is used by various non-SA tests 17 // to initialize the a registration for the test to reference. 18 func CreateWorkingRegistration(t *testing.T, sa sapb.StorageAuthorityClient) *corepb.Registration { 19 reg, err := sa.NewRegistration(context.Background(), &corepb.Registration{ 20 Key: []byte(`{ 21 "kty": "RSA", 22 "n": "n4EPtAOCc9AlkeQHPzHStgAbgs7bTZLwUBZdR8_KuKPEHLd4rHVTeT-O-XV2jRojdNhxJWTDvNd7nqQ0VEiZQHz_AJmSCpMaJMRBSFKrKb2wqVwGU_NsYOYL-QtiWN2lbzcEe6XC0dApr5ydQLrHqkHHig3RBordaZ6Aj-oBHqFEHYpPe7Tpe-OfVfHd1E6cS6M1FZcD1NNLYD5lFHpPI9bTwJlsde3uhGqC0ZCuEHg8lhzwOHrtIQbS0FVbb9k3-tVTU4fg_3L_vniUFAKwuCLqKnS2BYwdq_mzSnbLY7h_qixoR7jig3__kRhuaxwUkRz5iaiQkqgc5gHdrNP5zw", 23 "e": "AQAB" 24 }`), 25 CreatedAt: timestamppb.New(time.Date(2003, 5, 10, 0, 0, 0, 0, time.UTC)), 26 Status: string(core.StatusValid), 27 }) 28 if err != nil { 29 t.Fatalf("Unable to create new registration: %s", err) 30 } 31 return reg 32 }