Skip to content

Commit

Permalink
fix: Updated unit-test
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Morton <[email protected]>
  • Loading branch information
Kyle Morton committed Jul 26, 2022
1 parent c93afe6 commit 8dc1f92
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions internal/security/proxy/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,11 @@ func TestPostCertExists(t *testing.T) {
func TestPostCertHttpError(t *testing.T) {
fileName := "./testdata/configuration.toml"
contents, err := os.ReadFile(fileName)
if err != nil {
t.Errorf("could not load configuration file (%s): %s", fileName, err.Error())
return
}
require.NoError(t, err)

configuration := &config.ConfigurationStruct{}
err = toml.Unmarshal(contents, configuration)
if err != nil {
t.Errorf("unable to parse configuration file (%s): %s", fileName, err.Error())
return
}
require.NoError(t, err)

ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}))
defer ts.Close()
Expand All @@ -115,6 +109,7 @@ func TestPostCertHttpError(t *testing.T) {
service := NewService(NewRequestor(true, 10, "", mockLogger), mockLogger, configuration)
mockCertPair := bootstrapConfig.CertKeyPair{Cert: "test-certificate", Key: "test-private-key"}
e := service.postCert(mockCertPair)
require.Error(t, e)
if e.reason != CertExisting {
assert.Contains(t, e.Error(), "/admin/certificates")
}
Expand Down

0 comments on commit 8dc1f92

Please sign in to comment.