Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

1.0 KB
Raw Blame
package webhooks

import (
	"testing"
	"time"

	"github.com/owncast/owncast/models"
	"github.com/owncast/owncast/persistence/configrepository"
	"github.com/owncast/owncast/services/chat/events"
)

func TestSendStreamStatusEvent(t *testing.T) {
	configRepository := configrepository.New(testDatastore)

	configRepository.SetServerName("my server")
	configRepository.SetServerSummary("my server where I stream")
	configRepository.SetStreamTitle("my stream")

	checkPayload(t, models.StreamStarted, func() {
		testSvc.sendStreamStatusEvent(events.StreamStarted, "id", time.Unix(72, 6).UTC())
	}, `{
		"id": "id",
		"name": "my server",
		"serverURL": "http://localhost:8080",
		"status": {
			"lastConnectTime": null,
			"lastDisconnectTime": null,
			"online": true,
			"overallMaxViewerCount": 420,
			"sessionMaxViewerCount": 69,
			"streamTitle": "my stream",
			"versionNumber": "1.2.3",
			"viewerCount": 5
		},
		"streamTitle": "my stream",
		"summary": "my server where I stream",
		"timestamp": "1970-01-01T00:01:12.000000006Z"
	}`)
}