| 1 | package ntfy_testscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/ |
| 2 | |
| 3 | import ( |
| 4 | "encoding/base64scip-go gomod github.com/golang/go/src . `encoding/base64`/" |
| 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/requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/" |
| 10 | |
| 11 | "github.com/nicholas-fedor/shoutrrr/internal/metascip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/meta`/" |
| 12 | ) |
| 13 | |
| 14 | func TestAPIURLFormatscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestAPIURLFormat().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 15 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 16 | 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#) { |
| 17 | service, mockClient := createTestServiceWithMockscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestServiceWithMock().( |
| 18 | t, |
| 19 | "ntfy://ntfy.example.com/mytopic", |
| 20 | ) |
| 21 | |
| 22 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("test", nil) |
| 23 | 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) |
| 24 | |
| 25 | assertRequestMadescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/assertRequestMade().(t, mockClient, "https://ntfy.example.com/mytopic") |
| 26 | |
| 27 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 28 | }) |
| 29 | } |
| 30 | |
| 31 | func TestAPIURLFormatWithNestedTopicscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestAPIURLFormatWithNestedTopic().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 32 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 33 | 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#) { |
| 34 | service, mockClient := createTestServiceWithMockscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestServiceWithMock().( |
| 35 | t, |
| 36 | "ntfy://ntfy.example.com/alerts/critical", |
| 37 | ) |
| 38 | |
| 39 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("test", nil) |
| 40 | 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) |
| 41 | |
| 42 | assertRequestMadescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/assertRequestMade().(t, mockClient, "https://ntfy.example.com/alerts/critical") |
| 43 | |
| 44 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 45 | }) |
| 46 | } |
| 47 | |
| 48 | func TestHTTPMethodIsPostscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestHTTPMethodIsPost().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 49 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 50 | 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#) { |
| 51 | service, mockClient := createTestServiceWithMockscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestServiceWithMock().( |
| 52 | t, |
| 53 | validNtfyURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/validNtfyURL., |
| 54 | ) |
| 55 | |
| 56 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("test", nil) |
| 57 | 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) |
| 58 | |
| 59 | assertRequestMatchesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/assertRequestMatches().(t, mockClient, func(req *httpscip-go gomod github.com/golang/go/src . `net/http`/.Requestscip-go gomod github.com/golang/go/src . `net/http`/Request#) bool { |
| 60 | return req.Methodscip-go gomod github.com/golang/go/src . `net/http`/Request#Method. == httpscip-go gomod github.com/golang/go/src . `net/http`/.MethodPostscip-go gomod github.com/golang/go/src . `net/http`/MethodPost. |
| 61 | }, "POST method") |
| 62 | |
| 63 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 64 | }) |
| 65 | } |
| 66 | |
| 67 | func TestContentTypeHeaderscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestContentTypeHeader().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 68 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 69 | 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#) { |
| 70 | service, mockClient := createTestServiceWithMockscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestServiceWithMock().( |
| 71 | t, |
| 72 | validNtfyURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/validNtfyURL., |
| 73 | ) |
| 74 | |
| 75 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("test", nil) |
| 76 | 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) |
| 77 | |
| 78 | assertRequestHeaderContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/assertRequestHeaderContains().(t, mockClient, "Content-Type", "text/plain; charset=utf-8") |
| 79 | |
| 80 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 81 | }) |
| 82 | } |
| 83 | |
| 84 | func TestContentTypeHeaderMarkdownscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestContentTypeHeaderMarkdown().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 85 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 86 | 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#) { |
| 87 | service, mockClient := createTestServiceWithMockscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestServiceWithMock().( |
| 88 | t, |
| 89 | validNtfyURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/validNtfyURL.+"?markdown=yes", |
| 90 | ) |
| 91 | |
| 92 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("test", nil) |
| 93 | 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) |
| 94 | |
| 95 | assertRequestHeaderContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/assertRequestHeaderContains().(t, mockClient, "Content-Type", "text/markdown") |
| 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 TestUserAgentHeaderscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestUserAgentHeader().(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 | service, mockClient := createTestServiceWithMockscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestServiceWithMock().( |
| 105 | t, |
| 106 | validNtfyURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/validNtfyURL., |
| 107 | ) |
| 108 | |
| 109 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("test", nil) |
| 110 | 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) |
| 111 | |
| 112 | assertRequestMatchesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/assertRequestMatches().(t, mockClient, func(req *httpscip-go gomod github.com/golang/go/src . `net/http`/.Requestscip-go gomod github.com/golang/go/src . `net/http`/Request#) bool { |
| 113 | userAgent := req.Headerscip-go gomod github.com/golang/go/src . `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src . `net/http`/Header#Get().("User-Agent") |
| 114 | |
| 115 | return userAgent == "shoutrrr/"+metascip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/meta`/.Versionscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/meta`/Version. |
| 116 | }, "User-Agent header") |
| 117 | |
| 118 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 119 | }) |
| 120 | } |
| 121 | |
| 122 | func TestBasicAuthHeaderscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestBasicAuthHeader().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 123 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 124 | 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#) { |
| 125 | service, mockClient := createTestServiceWithMockscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestServiceWithMock().( |
| 126 | t, |
| 127 | "ntfy://myuser:[email protected]/mytopic", |
| 128 | ) |
| 129 | |
| 130 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("test", nil) |
| 131 | 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) |
| 132 | |
| 133 | assertRequestMatchesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/assertRequestMatches().(t, mockClient, func(req *httpscip-go gomod github.com/golang/go/src . `net/http`/.Requestscip-go gomod github.com/golang/go/src . `net/http`/Request#) bool { |
| 134 | authHeader := req.Headerscip-go gomod github.com/golang/go/src . `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src . `net/http`/Header#Get().("Authorization") |
| 135 | expected := "Basic " + base64scip-go gomod github.com/golang/go/src . `encoding/base64`/.StdEncodingscip-go gomod github.com/golang/go/src . `encoding/base64`/StdEncoding..EncodeToStringscip-go gomod github.com/golang/go/src . `encoding/base64`/Encoding#EncodeToString().([]byte("myuser:mypass")) |
| 136 | |
| 137 | return authHeader == expected |
| 138 | }, "Basic Auth header") |
| 139 | |
| 140 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 141 | }) |
| 142 | } |
| 143 | |
| 144 | func TestBasicAuthHeaderUsernameOnlyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestBasicAuthHeaderUsernameOnly().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 145 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 146 | 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#) { |
| 147 | service, mockClient := createTestServiceWithMockscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestServiceWithMock().( |
| 148 | t, |
| 149 | "ntfy://[email protected]/mytopic", |
| 150 | ) |
| 151 | |
| 152 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("test", nil) |
| 153 | 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) |
| 154 | |
| 155 | assertRequestMatchesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/assertRequestMatches().(t, mockClient, func(req *httpscip-go gomod github.com/golang/go/src . `net/http`/.Requestscip-go gomod github.com/golang/go/src . `net/http`/Request#) bool { |
| 156 | authHeader := req.Headerscip-go gomod github.com/golang/go/src . `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src . `net/http`/Header#Get().("Authorization") |
| 157 | expected := "Basic " + base64scip-go gomod github.com/golang/go/src . `encoding/base64`/.StdEncodingscip-go gomod github.com/golang/go/src . `encoding/base64`/StdEncoding..EncodeToStringscip-go gomod github.com/golang/go/src . `encoding/base64`/Encoding#EncodeToString().([]byte("myuser:")) |
| 158 | |
| 159 | return authHeader == expected |
| 160 | }, "Basic Auth header with username only") |
| 161 | |
| 162 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 163 | }) |
| 164 | } |
| 165 | |
| 166 | func TestDisableTLSUsesHTTPscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestDisableTLSUsesHTTP().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 167 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 168 | 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#) { |
| 169 | service, mockClient := createTestServiceWithMockscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestServiceWithMock().( |
| 170 | t, |
| 171 | "ntfy://ntfy.example.com/mytopic?disabletls=yes", |
| 172 | ) |
| 173 | |
| 174 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("test", nil) |
| 175 | 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) |
| 176 | |
| 177 | assertRequestMadescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/assertRequestMade().(t, mockClient, "http://ntfy.example.com/mytopic") |
| 178 | |
| 179 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 180 | }) |
| 181 | } |
| 182 | |
| 183 | func TestRequestBodyIsPlainTextscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestRequestBodyIsPlainText().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 184 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 185 | 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#) { |
| 186 | service, mockClient := createTestServiceWithMockscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestServiceWithMock().( |
| 187 | t, |
| 188 | validNtfyURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/validNtfyURL., |
| 189 | ) |
| 190 | |
| 191 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().("plain text body", nil) |
| 192 | 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) |
| 193 | |
| 194 | assertRequestMatchesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/assertRequestMatches().(t, mockClient, func(req *httpscip-go gomod github.com/golang/go/src . `net/http`/.Requestscip-go gomod github.com/golang/go/src . `net/http`/Request#) bool { |
| 195 | contentType := req.Headerscip-go gomod github.com/golang/go/src . `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src . `net/http`/Header#Get().("Content-Type") |
| 196 | |
| 197 | return contentType == "text/plain; charset=utf-8" |
| 198 | }, "plain text Content-Type") |
| 199 | |
| 200 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 201 | }) |
| 202 | } |
| 203 | |
| 204 | func TestRequestBodyContainsExactMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/TestRequestBodyContainsExactMessage().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 205 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 206 | 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#) { |
| 207 | service, mockClient := createTestServiceWithMockscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/createTestServiceWithMock().( |
| 208 | t, |
| 209 | validNtfyURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/validNtfyURL., |
| 210 | ) |
| 211 | |
| 212 | message := "Exact message body" |
| 213 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/ntfy`/Service#Send().(message, nil) |
| 214 | 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) |
| 215 | |
| 216 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/ntfy_test`/assertRequestContains().(t, mockClient, message) |
| 217 | |
| 218 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 219 | }) |
| 220 | } |