From 558afe7f04782fbd57ab483a7b95d7f6e43594f1 Mon Sep 17 00:00:00 2001 From: DazWilkin Date: Sun, 31 Jul 2016 18:26:58 -0700 Subject: [PATCH] Fixed Go tests --- .../inputs/webhooks/particle/particle_webhooks_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/inputs/webhooks/particle/particle_webhooks_test.go b/plugins/inputs/webhooks/particle/particle_webhooks_test.go index 479d6fd1d..0af51e9e2 100644 --- a/plugins/inputs/webhooks/particle/particle_webhooks_test.go +++ b/plugins/inputs/webhooks/particle/particle_webhooks_test.go @@ -1,6 +1,7 @@ package particle import ( + "bytes" "net/http" "net/http/httptest" "testing" @@ -8,10 +9,10 @@ import ( "github.com/influxdata/telegraf/testutil" ) -func ParticleWebhookRequest(urlEncodedString string, t *testing.T) { +func ParticleWebhookRequest(event string, urlEncodedString string, t *testing.T) { var acc testutil.Accumulator pwh := &ParticleWebhook{Path: "/particle", acc: &acc} - req, _ := http.NewRequest("POST", "/particle", urlEncodedString) + req, _ := http.NewRequest("POST", "/particle", bytes.NewBufferString(urlEncodedString)) w := httptest.NewRecorder() pwh.eventHandler(w, req) if w.Code != http.StatusOK { @@ -19,6 +20,6 @@ func ParticleWebhookRequest(urlEncodedString string, t *testing.T) { } } -func TestNewEvent(t *testing.T) { - ParticleWebhookRequest(NewEventURLEncoded()) +func TestParticleEvent(t *testing.T) { + ParticleWebhookRequest("particle_event", NewEventURLEncoded(), t) }