From 4d511bd29dbf06a72dffb455838429ec6a0c07d3 Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Thu, 13 Oct 2022 02:48:23 +1300 Subject: [PATCH] Testing: Add API test for raw & message headers --- server/server_test.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/server/server_test.go b/server/server_test.go index 3da915e..ecf4b70 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -54,15 +54,24 @@ func Test_APIv1(t *testing.T) { } // read first 10 - t.Log("Read first 10 messages") + t.Log("Read first 10 messages including raw & headers") putIDS := []string{} for indx, msg := range m.Messages { if indx == 10 { break } - _, err := clientGet(ts.URL + "/api/v1/message/" + msg.ID) - if err != nil { + if _, err := clientGet(ts.URL + "/api/v1/message/" + msg.ID); err != nil { + t.Errorf(err.Error()) + } + + // test RAW + if _, err := clientGet(ts.URL + "/api/v1/message/" + msg.ID + "/raw"); err != nil { + t.Errorf(err.Error()) + } + + // test headers + if _, err := clientGet(ts.URL + "/api/v1/message/" + msg.ID + "/headers"); err != nil { t.Errorf(err.Error()) }