package soapcalls import ( "context" "net/http" "net/http/httptest" "testing" ) func TestDMRextractor(t *testing.T) { raw := ` urn:schemas-upnp-org:service:RenderingControl:1 urn:upnp-org:serviceId:RenderingControl /upnp/control/RenderingControl1 /upnp/event/RenderingControl1 /RenderingControl_1.xml urn:schemas-upnp-org:service:ConnectionManager:1 urn:upnp-org:serviceId:ConnectionManager /upnp/control/ConnectionManager1 /upnp/event/ConnectionManager1 /ConnectionManager_1.xml urn:schemas-upnp-org:service:AVTransport:1 urn:upnp-org:serviceId:AVTransport /upnp/control/AVTransport1 /upnp/event/AVTransport1 /AVTransport_1.xml ` testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { _, _ = w.Write([]byte(raw)) })) defer testServer.Close() _, err := DMRextractor(context.Background(), testServer.URL) if err != nil { t.Fatalf("Failed to call DMRextractor due to %s", err.Error()) } }