Debian Codegraph @

testing/integration/ntfy/errors_test.go

raw symbols SCIP
1 package ntfy_testscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/
2
3 import (
4 "errorsscip-go gomod github.com/golang/go/src . errors/"
5 "net/httpscip-go gomod github.com/golang/go/src . `net/http`/"
6 "testingscip-go gomod github.com/golang/go/src . testing/"
7 "testing/synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/"
8
9 "github.com/stretchr/testify/mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/"
10 "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/"
11 )
12
13 func TestSendWithHTTPErrorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestSendWithHTTPError().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
14 t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().()
15 synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
16 mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/MockHTTPClient#{}
17 service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestService().(
18 t,
19 validNtfyURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/validNtfyURL.,
20 mockClient,
21 )
22
23 mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.).
24 Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(nil, errorsscip-go gomod github.com/golang/go/src . errors/.Newscip-go gomod github.com/golang/go/src . errors/New().("connection refused")).
25 Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().()
26
27 err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("Test message", nil)
28 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Errorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Error().(t, err)
29 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Containsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Contains().(t, err.Error(), "posting to ntfy API")
30
31 mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t)
32 })
33 }
34
35 func TestSendWith400BadRequestscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestSendWith400BadRequest().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
36 t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().()
37 synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
38 mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/MockHTTPClient#{}
39 service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestService().(
40 t,
41 validNtfyURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/validNtfyURL.,
42 mockClient,
43 )
44
45 mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.).
46 Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusBadRequestscip-go gomod github.com/golang/go/src . `net/http`/StatusBadRequest., `{"code":400,"error":"invalid request","link":"https://docs.ntfy.sh"}`), nil).
47 Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().()
48
49 err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("Test message", nil)
50 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Errorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Error().(t, err)
51 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Containsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Contains().(t, err.Error(), "invalid request")
52
53 mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t)
54 })
55 }
56
57 func TestSendWith401Unauthorizedscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestSendWith401Unauthorized().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
58 t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().()
59 synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
60 mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/MockHTTPClient#{}
61 service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestService().(
62 t,
63 validNtfyURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/validNtfyURL.,
64 mockClient,
65 )
66
67 mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.).
68 Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusUnauthorizedscip-go gomod github.com/golang/go/src . `net/http`/StatusUnauthorized., `{"code":401,"error":"unauthorized"}`), nil).
69 Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().()
70
71 err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("Test message", nil)
72 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Errorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Error().(t, err)
73 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Containsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Contains().(t, err.Error(), "unauthorized")
74
75 mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t)
76 })
77 }
78
79 func TestSendWith403Forbiddenscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestSendWith403Forbidden().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
80 t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().()
81 synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
82 mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/MockHTTPClient#{}
83 service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestService().(
84 t,
85 validNtfyURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/validNtfyURL.,
86 mockClient,
87 )
88
89 mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.).
90 Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusForbiddenscip-go gomod github.com/golang/go/src . `net/http`/StatusForbidden., `{"code":403,"error":"forbidden"}`), nil).
91 Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().()
92
93 err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("Test message", nil)
94 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Errorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Error().(t, err)
95 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Containsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Contains().(t, err.Error(), "forbidden")
96
97 mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t)
98 })
99 }
100
101 func TestSendWith404NotFoundscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestSendWith404NotFound().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
102 t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().()
103 synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
104 mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/MockHTTPClient#{}
105 service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestService().(
106 t,
107 validNtfyURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/validNtfyURL.,
108 mockClient,
109 )
110
111 mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.).
112 Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNotFoundscip-go gomod github.com/golang/go/src . `net/http`/StatusNotFound., `{"code":404,"error":"not found"}`), nil).
113 Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().()
114
115 err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("Test message", nil)
116 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Errorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Error().(t, err)
117 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Containsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Contains().(t, err.Error(), "not found")
118
119 mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t)
120 })
121 }
122
123 func TestSendWith500ServerErrorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestSendWith500ServerError().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
124 t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().()
125 synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
126 mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/MockHTTPClient#{}
127 service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestService().(
128 t,
129 validNtfyURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/validNtfyURL.,
130 mockClient,
131 )
132
133 mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.).
134 Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusInternalServerErrorscip-go gomod github.com/golang/go/src . `net/http`/StatusInternalServerError., `{"code":500,"error":"internal server error"}`), nil).
135 Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().()
136
137 err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("Test message", nil)
138 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Errorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Error().(t, err)
139 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Containsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Contains().(t, err.Error(), "internal server error")
140
141 mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t)
142 })
143 }
144
145 func TestSendWithMalformedAPIErrorResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestSendWithMalformedAPIErrorResponse().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
146 t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().()
147 synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
148 mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/MockHTTPClient#{}
149 service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestService().(
150 t,
151 validNtfyURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/validNtfyURL.,
152 mockClient,
153 )
154
155 mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.).
156 Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusBadRequestscip-go gomod github.com/golang/go/src . `net/http`/StatusBadRequest., `not json`), nil).
157 Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().()
158
159 err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("Test message", nil)
160 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Errorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Error().(t, err)
161 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Containsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Contains().(t, err.Error(), "posting to ntfy API")
162
163 mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t)
164 })
165 }
166
167 func TestSendWithEmptyErrorBodyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestSendWithEmptyErrorBody().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
168 t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().()
169 synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
170 mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/MockHTTPClient#{}
171 service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestService().(
172 t,
173 validNtfyURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/validNtfyURL.,
174 mockClient,
175 )
176
177 mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.).
178 Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusInternalServerErrorscip-go gomod github.com/golang/go/src . `net/http`/StatusInternalServerError., ``), nil).
179 Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().()
180
181 err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("Test message", nil)
182 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Errorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Error().(t, err)
183 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Containsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Contains().(t, err.Error(), "posting to ntfy API")
184
185 mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t)
186 })
187 }
188
189 func TestSendWithTimeoutscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestSendWithTimeout().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
190 t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().()
191 synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
192 mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/MockHTTPClient#{}
193 service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestService().(
194 t,
195 validNtfyURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/validNtfyURL.,
196 mockClient,
197 )
198
199 mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.).
200 Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(nil, errorsscip-go gomod github.com/golang/go/src . errors/.Newscip-go gomod github.com/golang/go/src . errors/New().("deadline exceeded")).
201 Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().()
202
203 err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("Test message", nil)
204 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Errorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Error().(t, err)
205 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Containsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Contains().(t, err.Error(), "posting to ntfy API")
206
207 mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t)
208 })
209 }
210
211 func TestSendWithNilParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestSendWithNilParams().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
212 t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().()
213 synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
214 mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/MockHTTPClient#{}
215 service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestService().(
216 t,
217 validNtfyURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/validNtfyURL.,
218 mockClient,
219 )
220
221 mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.).
222 Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"code":200,"error":"OK"}`), nil).
223 Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().()
224
225 err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("Message with nil params", nil)
226 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/NoError().(t, err)
227
228 mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t)
229 })
230 }
231
232 func TestSendWithEmptyParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestSendWithEmptyParams().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
233 t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().()
234 synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
235 mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/MockHTTPClient#{}
236 service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestService().(
237 t,
238 validNtfyURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/validNtfyURL.,
239 mockClient,
240 )
241
242 mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.).
243 Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"code":200,"error":"OK"}`), nil).
244 Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().()
245
246 params := createTestParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestParams().()
247 err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("Message with empty params", params)
248 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/NoError().(t, err)
249
250 mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t)
251 })
252 }
253
254 func TestSendWithStructuredAPIErrorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestSendWithStructuredAPIError().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
255 t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().()
256 synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/.Testscip-go gomod github.com/golang/go/src . `testing/synctest`/Test().(t, func(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) {
257 mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/MockHTTPClient#{}
258 service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestService().(
259 t,
260 validNtfyURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/validNtfyURL.,
261 mockClient,
262 )
263
264 mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Anythingscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Anything.).
265 Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusBadRequestscip-go gomod github.com/golang/go/src . `net/http`/StatusBadRequest., `{"code":400,"error":"invalid request","link":"https://docs.ntfy.sh"}`), nil).
266 Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().()
267
268 err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("Test message", nil)
269 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Errorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Error().(t, err)
270 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Containsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Contains().(t, err.Error(), "server response")
271 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Containsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Contains().(t, err.Error(), "invalid request")
272 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Containsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Contains().(t, err.Error(), "400")
273 requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Containsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Contains().(t, err.Error(), "https://docs.ntfy.sh")
274
275 mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t)
276 })
277 }