From 9f6aaa2cb98a5050125e7a8c3f4b06b0b6ba0683 Mon Sep 17 00:00:00 2001 From: Ivan Tivonenko Date: Tue, 26 Feb 2019 16:17:55 +0200 Subject: [PATCH] webhook tests --- server/mediaserver_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/server/mediaserver_test.go b/server/mediaserver_test.go index 2fcd4d12eb..b8246e5ca8 100644 --- a/server/mediaserver_test.go +++ b/server/mediaserver_test.go @@ -177,6 +177,25 @@ func TestSelectOrchestrator(t *testing.T) { assert.Equal(expSessionID, sess.PMSessionID) } +func TestCreateRTMPStreamHandlerWebhook(t *testing.T) { + s := setupServer() + s.RTMPSegmenter = &StubSegmenter{skip: true} + createSid := createRTMPStreamIDHandler(s) + WebhookURL = "http://localhost:8938/notexisting" + u, _ := url.Parse("http://hot/something/?manifestID=id1") + sid := createSid(u) + if sid != "" { + t.Error("Webhook auth failed") + } + WebhookURL = "http://localhost:8938/status" + u, _ = url.Parse("http://hot/something/?manifestID=id2") + sid = createSid(u) + if sid == "" { + t.Error("Webhook auth failed 2") + } + WebhookURL = "" +} + func TestCreateRTMPStreamHandler(t *testing.T) { // Monkey patch rng to avoid unpredictability even when seeding