File: eventing_test.go

package info (click to toggle)
golang-github-anacrolix-dms 1.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 436 kB
  • sloc: xml: 19; sh: 19; makefile: 9
file content (42 lines) | stat: -rw-r--r-- 772 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package upnp

import (
	"encoding/xml"
	"testing"
)

// Visually verify that property sets are marshalled correctly.
func TestMarshalPropertySet(t *testing.T) {
	b, err := xml.MarshalIndent(&PropertySet{
		Properties: []Property{
			{
				Variable: Variable{
					XMLName: xml.Name{
						Local: "SystemUpdateID",
					},
					Value: "0",
				},
			},
			{
				Variable: Variable{
					XMLName: xml.Name{
						Local: "answerToTheUniverse",
					},
					Value: "42",
				},
			},
		},
		Space: "urn:schemas-upnp-org:event-1-0",
	}, "", "  ")
	t.Log("\n" + string(b))
	if err != nil {
		t.Fatal(err)
	}
}

func TestParseCallbackURLs(t *testing.T) {
	urls := ParseCallbackURLs("<http://hello><http://path>     <http://world>")
	if len(urls) != 3 {
		t.Fatal(len(urls))
	}
}