stream_test.go 876 B

123456789101112131415161718192021222324252627282930313233343536
  1. package webhooks
  2. import (
  3. "testing"
  4. "time"
  5. "github.com/owncast/owncast/core/chat/events"
  6. "github.com/owncast/owncast/core/data"
  7. "github.com/owncast/owncast/models"
  8. )
  9. func TestSendStreamStatusEvent(t *testing.T) {
  10. data.SetServerName("my server")
  11. data.SetServerSummary("my server where I stream")
  12. data.SetStreamTitle("my stream")
  13. checkPayload(t, models.StreamStarted, func() {
  14. sendStreamStatusEvent(events.StreamStarted, "id", time.Unix(72, 6).UTC())
  15. }, `{
  16. "id": "id",
  17. "name": "my server",
  18. "streamTitle": "my stream",
  19. "summary": "my server where I stream",
  20. "timestamp": "1970-01-01T00:01:12.000000006Z",
  21. "status": {
  22. "lastConnectTime": null,
  23. "lastDisconnectTime": null,
  24. "online": true,
  25. "overallMaxViewerCount": 420,
  26. "sessionMaxViewerCount": 69,
  27. "streamTitle": "my stream",
  28. "versionNumber": "1.2.3",
  29. "viewerCount": 5
  30. }
  31. }`)
  32. }