File: notify_test.go

package info (click to toggle)
golang-github-thecreeper-go-notify 0.0~git20160203.0.b5cd147-4.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 68 kB
  • sloc: makefile: 6; sh: 4
file content (72 lines) | stat: -rw-r--r-- 1,856 bytes parent folder | download | duplicates (3)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package notify

import "testing"

func TestGetCapabilities(t *testing.T) {
	c, err := GetCapabilities()
	if err != nil {
		t.Fatal(err)
	}

	t.Logf("Support Action Icons: %v\n", c.ActionIcons)
	t.Logf("Support Actions: %v\n", c.Actions)
	t.Logf("Support Body: %v\n", c.Body)
	t.Logf("Support Body Hyperlinks: %v\n", c.BodyHyperlinks)
	t.Logf("Support Body Images: %v\n", c.BodyImages)
	t.Logf("Support Body Markup: %v\n", c.BodyMarkup)
	t.Logf("Support Icon Multi: %v\n", c.IconMulti)
	t.Logf("Support Icon Static: %v\n", c.IconStatic)
	t.Logf("Support Persistence: %v\n", c.Persistence)
	t.Logf("Support Sound: %v\n", c.Sound)
}

func TestGetServerInformation(t *testing.T) {
	info, err := GetServerInformation()
	if err != nil {
		t.Fatal(err)
	}

	t.Logf("Server Name: %s\n", info.Name)
	t.Logf("Server Spec Version: %s\n", info.SpecVersion)
	t.Logf("Server Vendor: %s\n", info.Vendor)
	t.Logf("Sserver Version: %s\n", info.Version)
}

func TestNewNotification(t *testing.T) {
	ntf := NewNotification("Notification Test", "Just a test")
	if _, err := ntf.Show(); err != nil {
		t.Fatal(err)
	}
}

func TestCloseNotification(t *testing.T) {
	ntf := NewNotification("Notification Test", "Just a test")
	id, err := ntf.Show()
	if err != nil {
		t.Fatal(err)
	}

	if err = CloseNotification(id); err != nil {
		t.Fatal(err)
	}
}

func TestUrgencyNotification(t *testing.T) {
	ntfLow := NewNotification("Urgency Test", "Testing notification urgency low")
	ntfLow.Hints = make(map[string]interface{})

	ntfLow.Hints[HintUrgency] = UrgencyLow
	_, err := ntfLow.Show()
	if err != nil {
		t.Fatal(err)
	}

	ntfCritical := NewNotification("Urgency Test", "Testing notification urgency critical")
	ntfCritical.Hints = make(map[string]interface{})

	ntfCritical.Hints[HintUrgency] = UrgencyCritical
	_, err = ntfCritical.Show()
	if err != nil {
		t.Fatal(err)
	}
}