// generate private key privatekey, err := rsa.GenerateKey(rand.Reader, 2048) Expect(err).To(BeNil()) cert, err := x509.CreateCertificate(rand.Reader, template, template, &privatekey.PublicKey, privatekey) Expect(err).To(BeNil()) certOut := new(bytes.Buffer) err = pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: cert}) Expect(err).To(BeNil()) body := []lightWaveCert{ lightWaveCert{Value: certOut.String()}, } server.SetResponseJsonForPath(certDownloadPath, 200, body) }) It("retrieves certificates", func() { certList, err := client.GetRootCerts() Expect(err).To(BeNil()) Expect(certList).ToNot(BeNil()) Expect(len(certList)).To(BeNumerically(">", 0)) }) }) Context("when server responds with unsupported format", func() { BeforeEach(func() { server.SetResponseForPath(certDownloadPath, 200, "text") })