MCPcopy Create free account
hub / github.com/CyCoreSystems/ari-proxy / TestMailboxUpdate

Function TestMailboxUpdate

internal/integration/mailbox.go:88–130  ·  view source on GitHub ↗
(t *testing.T, s Server)

Source from the content-addressed store, hash-verified

86}
87
88func TestMailboxUpdate(t *testing.T, s Server) {
89 key := ari.NewKey(ari.MailboxKey, "mbox1")
90
91 runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) {
92 var expected error
93
94 m.Mailbox.On("Update", key, 1, 1).Return(expected)
95
96 err := cl.Mailbox().Update(key, 1, 1)
97
98 failed := false
99 failed = failed || err == nil && expected != nil
100 failed = failed || err != nil && expected == nil
101 failed = failed || err != nil && expected != nil && err.Error() != expected.Error() // nolint
102 if failed {
103 t.Errorf("Expected mailbox %s(%s) to return '%v', got '%v'",
104 "Update", "mbox1", expected, err,
105 )
106 }
107
108 m.Mailbox.AssertCalled(t, "Update", key, 1, 1)
109 })
110
111 runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) {
112 expected := errors.New("error")
113
114 m.Mailbox.On("Update", key, 1, 1).Return(expected)
115
116 err := cl.Mailbox().Update(key, 1, 1)
117
118 failed := false
119 failed = failed || err == nil && expected != nil
120 failed = failed || err != nil && expected == nil
121 failed = failed || err != nil && expected != nil && err.Error() != expected.Error()
122 if failed {
123 t.Errorf("Expected mailbox %s(%s) to return '%v', got '%v'",
124 "Update", "mbox1", expected, err,
125 )
126 }
127
128 m.Mailbox.AssertCalled(t, "Update", key, 1, 1)
129 })
130}
131
132func TestMailboxData(t *testing.T, s Server) {
133 key := ari.NewKey(ari.MailboxKey, "mbox1")

Callers 2

TestMailboxUpdateFunction · 0.92
TestMailboxUpdateFunction · 0.92

Calls 5

runTestFunction · 0.85
MailboxMethod · 0.80
NewMethod · 0.80
UpdateMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected