bulid 63
This commit is contained in:
17
agent/scanner_test.go
Normal file
17
agent/scanner_test.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestScanVmixInventory(t *testing.T) {
|
||||
xml := `<vmix><version>29.0.0.48</version><inputs><input key="abc" number="12" type="GT" title="Scorebug"><text index="0" name="HomeTeam.Text">SKA</text><image index="0" name="HomeLogo.Source">c:\\logo.png</image></input></inputs></vmix>`
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/xml"); _, _ = w.Write([]byte(xml)) }))
|
||||
defer srv.Close()
|
||||
status, inv := scanVmix(srv.URL)
|
||||
if !status.Connected || status.Version != "29.0.0.48" { t.Fatalf("bad status: %+v", status) }
|
||||
if inv.InputCount != 1 || inv.FieldCount != 2 || len(inv.Fingerprint) != 64 { t.Fatalf("bad inventory: %+v", inv) }
|
||||
if inv.Inputs[0].Title != "Scorebug" || len(inv.Inputs[0].Fields) != 2 { t.Fatalf("bad input: %+v", inv.Inputs[0]) }
|
||||
}
|
||||
Reference in New Issue
Block a user