mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 13:46:44 -04:00
30 lines
1003 B
Go
30 lines
1003 B
Go
// Copyright 2016 Team 254. All Rights Reserved.
|
|
// Author: pat@patfairbank.com (Patrick Fairbank)
|
|
|
|
package partner
|
|
|
|
import (
|
|
"github.com/Team254/cheesy-arena/model"
|
|
"github.com/stretchr/testify/assert"
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestPublishMatchVideoSplit(t *testing.T) {
|
|
// Mock the STEMtv server.
|
|
stemTvServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
assert.Equal(t, "/event/api/v1.0/my_event_code/qm254/split/981187501,981187690", r.URL.String())
|
|
}))
|
|
defer stemTvServer.Close()
|
|
|
|
client := NewStemTvClient("my_event_code")
|
|
client.BaseUrl = stemTvServer.URL
|
|
|
|
matchStartedTime, _ := time.Parse("2006-01-02 15:04:05 -0700", "2001-02-03 04:05:06 -0400")
|
|
match := &model.Match{Type: "qualification", DisplayName: "254", StartedAt: matchStartedTime}
|
|
scoreDisplayTime, _ := time.Parse("2006-01-02 15:04:05 -0700", "2001-02-03 04:08:00 -0400")
|
|
assert.Nil(t, client.PublishMatchVideoSplit(match, scoreDisplayTime))
|
|
}
|