From 0ed831de275f4eb45f829fb0b1fc8bf1aea517ab Mon Sep 17 00:00:00 2001 From: Eric Rutherford Date: Mon, 15 Jun 2020 10:21:42 -0500 Subject: [PATCH 1/2] fixing a typo in the new testing assertions --- assertions.go | 6 +++--- assertions_test.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/assertions.go b/assertions.go index 94bbbfd..f20a8f0 100644 --- a/assertions.go +++ b/assertions.go @@ -70,7 +70,7 @@ func (h *requiredHeaderValue) Assert(r *http.Request) error { // Log prints a testing info log for the requiredHeaderValue Assertor func (h *requiredHeaderValue) Log(t testing.TB) { - t.Logf("Testing request for required header value [%s: %s]", h.Key, h.ExpectedValue) + t.Logf("Testing request for a required header value [%s: %s]", h.Key, h.ExpectedValue) } // Error prints a testing error for the requiredHeaderValue Assertor @@ -126,7 +126,7 @@ func (q *requiredQueryValue) Assert(r *http.Request) error { // Log prints a testing info log for the requiredQueryValue Assertor func (q *requiredQueryValue) Log(t testing.TB) { - t.Logf("Testing request for required query parameter value [%s: %s]", q.Key, q.ExpectedValue) + t.Logf("Testing request for a required query parameter value [%s: %s]", q.Key, q.ExpectedValue) } // Error prints a testing error for the requiredQueryValue Assertor @@ -161,7 +161,7 @@ func (b *requiredBody) Assert(r *http.Request) error { // Log prints a testing info log for the requiredBody Assertor func (b *requiredBody) Log(t testing.TB) { - t.Log("Testing request for required a required body") + t.Log("Testing request for a required body value") } // Error prints a testing error for the requiredBody Assertor diff --git a/assertions_test.go b/assertions_test.go index 7a23e84..89472cd 100644 --- a/assertions_test.go +++ b/assertions_test.go @@ -315,7 +315,7 @@ func TestAssertors_Log(t *testing.T) { buf: &bytes.Buffer{}, }, assertor: &requiredHeaderValue{Key: "test-key", ExpectedValue: "test-value"}, - expected: "Testing request for required header value [test-key: test-value]", + expected: "Testing request for a required header value [test-key: test-value]", }, { name: "requiredQueries Log should log the expected output when called", @@ -331,7 +331,7 @@ func TestAssertors_Log(t *testing.T) { buf: &bytes.Buffer{}, }, assertor: &requiredQueryValue{Key: "test-key", ExpectedValue: "test-value"}, - expected: "Testing request for required query parameter value [test-key: test-value]", + expected: "Testing request for a required query parameter value [test-key: test-value]", }, { name: "requiredBody Log should log the expected output when called", @@ -339,7 +339,7 @@ func TestAssertors_Log(t *testing.T) { buf: &bytes.Buffer{}, }, assertor: &requiredBody{}, - expected: "Testing request for required a required body\n", + expected: "Testing request for a required body value\n", }, } for _, tt := range tests { From 6cfbcb57d3e1ada027ab1846cb18f383bf53835e Mon Sep 17 00:00:00 2001 From: Eric Rutherford Date: Mon, 15 Jun 2020 11:16:47 -0500 Subject: [PATCH 2/2] removing error wrapping to unbreak support for 1.12 --- assertions.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assertions.go b/assertions.go index f20a8f0..2a9bf90 100644 --- a/assertions.go +++ b/assertions.go @@ -147,7 +147,7 @@ func (b *requiredBody) Assert(r *http.Request) error { body, err := ioutil.ReadAll(r.Body) if err != nil { - return fmt.Errorf("error reading the request body: %w", err) + return fmt.Errorf("error reading the request body: %s", err.Error()) } if !bytes.EqualFold(b.ExpectedBody, body) {