| 1 | package discord_testscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/ |
| 2 | |
| 3 | import ( |
| 4 | "net/httpscip-go gomod github.com/golang/go/src . `net/http`/" |
| 5 | "net/urlscip-go gomod github.com/golang/go/src . `net/url`/" |
| 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 | "github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discordscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/" |
| 13 | "github.com/nicholas-fedor/shoutrrr/pkg/typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/" |
| 14 | ) |
| 15 | |
| 16 | const contentTypeJSONscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/contentTypeJSON. = "application/json" |
| 17 | |
| 18 | func TestWebhookURLFormatCompliancescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestWebhookURLFormatCompliance().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 19 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 20 | 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#) { |
| 21 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 22 | |
| 23 | tests := []struct { |
| 24 | name string |
| 25 | url string |
| 26 | shouldError bool |
| 27 | }{ |
| 28 | {"valid webhook URL", "discord://token@123", false}, |
| 29 | {"webhook with numbers", "discord://123@456", false}, |
| 30 | {"webhook with special chars", "discord://token_123@webhook-456", false}, |
| 31 | {"empty token", "discord://@webhook", true}, |
| 32 | {"empty webhook", "discord://token@", true}, |
| 33 | {"missing scheme", "token@webhook", true}, |
| 34 | {"wrong scheme", "http://token@webhook", false}, |
| 35 | {"invalid host", "discord://[email protected]/webhook", true}, |
| 36 | {"invalid path", "discord://token@123456789/invalid", true}, |
| 37 | } |
| 38 | |
| 39 | for _, tt := range tests { |
| 40 | parsedURL, parseErr := urlscip-go gomod github.com/golang/go/src . `net/url`/.Parsescip-go gomod github.com/golang/go/src . `net/url`/Parse().(tt.url) |
| 41 | if parseErr != nil { |
| 42 | // URL parsing failed |
| 43 | if tt.shouldError { |
| 44 | // Expected to fail |
| 45 | continue |
| 46 | } |
| 47 | // Unexpected parse failure |
| 48 | t.Fatalfscip-go gomod github.com/golang/go/src . testing/common#Fatalf().("Unexpected URL parse error for %s: %v", tt.name, parseErr) |
| 49 | } |
| 50 | |
| 51 | // URL parsed successfully, try to create service |
| 52 | service := &discordscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/.Servicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#{} |
| 53 | |
| 54 | initErr := service.Initializescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#Initialize().(parsedURL, &mockLoggerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/mockLogger#{}) |
| 55 | if initErr != nil { |
| 56 | // Initialize failed |
| 57 | if tt.shouldError { |
| 58 | // Expected to fail |
| 59 | continue |
| 60 | } |
| 61 | // Unexpected init failure |
| 62 | t.Fatalfscip-go gomod github.com/golang/go/src . testing/common#Fatalf().("Unexpected Initialize error for %s: %v", tt.name, initErr) |
| 63 | } |
| 64 | |
| 65 | // Initialize succeeded, set up mock and test Send |
| 66 | 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.). |
| 67 | 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/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 68 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 69 | |
| 70 | // Override HTTPClient after Initialize |
| 71 | service.HTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#HTTPClient. = mockClient |
| 72 | |
| 73 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#Send().("test", nil) |
| 74 | 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, "Expected no error for valid test case: %s", tt.name) |
| 75 | } |
| 76 | |
| 77 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 78 | }) |
| 79 | } |
| 80 | |
| 81 | func TestPayloadStructureCompliancescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestPayloadStructureCompliance().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 82 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 83 | 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#) { |
| 84 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 85 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 86 | t, |
| 87 | "discord://test-token@test-webhook", |
| 88 | mockClient, |
| 89 | ) |
| 90 | |
| 91 | 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.). |
| 92 | 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/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 93 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 94 | |
| 95 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#Send().("Test message", nil) |
| 96 | |
| 97 | 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) |
| 98 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/assertRequestContains().(t, mockClient, `"content":"Test message"`) |
| 99 | |
| 100 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 101 | }) |
| 102 | } |
| 103 | |
| 104 | func TestEmbedStructureCompliancescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestEmbedStructureCompliance().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 105 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 106 | 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#) { |
| 107 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 108 | 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.). |
| 109 | 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/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 110 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 111 | |
| 112 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 113 | t, |
| 114 | "discord://test-token@test-webhook", |
| 115 | mockClient, |
| 116 | ) |
| 117 | |
| 118 | items := []typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/.MessageItemscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/MessageItem#{ |
| 119 | { |
| 120 | Textscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/MessageItem#Text.: "Test embed", |
| 121 | Fieldsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/MessageItem#Fields.: []typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/.Fieldscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Field#{ |
| 122 | {Keyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Field#Key.: "embed_author_name", Valuescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Field#Value.: "Test Author"}, |
| 123 | {Keyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Field#Key.: "embed_image_url", Valuescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Field#Value.: "https://example.com/image.png"}, |
| 124 | {Keyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Field#Key.: "embed_thumbnail_url", Valuescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Field#Value.: "https://example.com/thumb.png"}, |
| 125 | {Keyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Field#Key.: "Field1", Valuescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Field#Value.: "Value1"}, |
| 126 | }, |
| 127 | Levelscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/MessageItem#Level.: typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/.Infoscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Info., |
| 128 | }, |
| 129 | } |
| 130 | |
| 131 | err := service.SendItemsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#SendItems().(items, nil) |
| 132 | |
| 133 | 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) |
| 134 | // Verify embed structure |
| 135 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/assertRequestContains().(t, mockClient, `"embeds":[{`) |
| 136 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/assertRequestContains().(t, mockClient, `"description":"Test embed"`) |
| 137 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/assertRequestContains().(t, mockClient, `"author":{"name":"Test Author"}`) |
| 138 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/assertRequestContains().( |
| 139 | t, |
| 140 | mockClient, |
| 141 | `"fields":[{"name":"Field1","value":"Value1"}]`, |
| 142 | ) |
| 143 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/assertRequestContains().( |
| 144 | t, |
| 145 | mockClient, |
| 146 | `"image":{"url":"https://example.com/image.png"}`, |
| 147 | ) |
| 148 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/assertRequestContains().( |
| 149 | t, |
| 150 | mockClient, |
| 151 | `"thumbnail":{"url":"https://example.com/thumb.png"}`, |
| 152 | ) |
| 153 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/assertRequestContains().(t, mockClient, `"footer":{"text":"Info"}`) |
| 154 | |
| 155 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 156 | }) |
| 157 | } |
| 158 | |
| 159 | func TestFileUploadCompliancescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestFileUploadCompliance().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 160 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 161 | 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#) { |
| 162 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 163 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 164 | t, |
| 165 | "discord://test-token@test-webhook", |
| 166 | mockClient, |
| 167 | ) |
| 168 | |
| 169 | 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.). |
| 170 | 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/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 171 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 172 | |
| 173 | items := []typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/.MessageItemscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/MessageItem#{ |
| 174 | createTestMessageItemWithFilescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestMessageItemWithFile().("File message", "test.txt", []byte("file content")), |
| 175 | } |
| 176 | |
| 177 | err := service.SendItemsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#SendItems().(items, nil) |
| 178 | |
| 179 | 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) |
| 180 | // Verify multipart form data structure |
| 181 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/assertRequestContains().(t, mockClient, "Content-Disposition: form-data") |
| 182 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/assertRequestContains().(t, mockClient, `name="payload_json"`) |
| 183 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/assertRequestContains().(t, mockClient, `name="files[0]"`) |
| 184 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/assertRequestContains().(t, mockClient, `filename="test.txt"`) |
| 185 | |
| 186 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 187 | }) |
| 188 | } |
| 189 | |
| 190 | func TestThreadParameterCompliancescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestThreadParameterCompliance().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 191 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 192 | 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#) { |
| 193 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 194 | 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.). |
| 195 | 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/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 196 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 197 | |
| 198 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 199 | t, |
| 200 | "discord://test-token@test-webhook?thread_id=123456", |
| 201 | mockClient, |
| 202 | ) |
| 203 | |
| 204 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#Send().("Thread message", nil) |
| 205 | |
| 206 | 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) |
| 207 | assertRequestMadescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/assertRequestMade().( |
| 208 | t, |
| 209 | mockClient, |
| 210 | "https://discord.com/api/webhooks/test-webhook/test-token?thread_id=123456", |
| 211 | ) |
| 212 | |
| 213 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 214 | }) |
| 215 | } |
| 216 | |
| 217 | func TestUsernameAvatarCompliancescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestUsernameAvatarCompliance().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 218 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 219 | 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#) { |
| 220 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 221 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 222 | t, |
| 223 | "discord://test-token@test-webhook", |
| 224 | mockClient, |
| 225 | ) |
| 226 | |
| 227 | 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.). |
| 228 | 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/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 229 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 230 | |
| 231 | params := createTestParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestParams().( |
| 232 | "username", |
| 233 | "TestBot", |
| 234 | "avatar", |
| 235 | "https://example.com/avatar.png", |
| 236 | ) |
| 237 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#Send().("Message with username/avatar", params) |
| 238 | |
| 239 | 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) |
| 240 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/assertRequestContains().(t, mockClient, `"username":"TestBot"`) |
| 241 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/assertRequestContains().( |
| 242 | t, |
| 243 | mockClient, |
| 244 | `"avatar_url":"https://example.com/avatar.png"`, |
| 245 | ) |
| 246 | |
| 247 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 248 | }) |
| 249 | } |
| 250 | |
| 251 | func TestJSONModeCompliancescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestJSONModeCompliance().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 252 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 253 | 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#) { |
| 254 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 255 | 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.). |
| 256 | 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/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 257 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 258 | |
| 259 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 260 | t, |
| 261 | "discord://test-token@test-webhook?json=true", |
| 262 | mockClient, |
| 263 | ) |
| 264 | |
| 265 | jsonPayload := `{"content": "Raw JSON message", "tts": true}` |
| 266 | |
| 267 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#Send().(jsonPayload, nil) |
| 268 | |
| 269 | 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) |
| 270 | assertRequestBodyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/assertRequestBody().(t, mockClient, jsonPayload) |
| 271 | |
| 272 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 273 | }) |
| 274 | } |
| 275 | |
| 276 | func TestRateLimitHeaderCompliancescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestRateLimitHeaderCompliance().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 277 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 278 | 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#) { |
| 279 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 280 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 281 | t, |
| 282 | "discord://test-token@test-webhook", |
| 283 | mockClient, |
| 284 | ) |
| 285 | |
| 286 | // Test that service respects rate limit responses |
| 287 | 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.). |
| 288 | 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/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusTooManyRequestsscip-go gomod github.com/golang/go/src . `net/http`/StatusTooManyRequests., `{"retry_after": 1}`), nil). |
| 289 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 290 | 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.). |
| 291 | 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/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 292 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 293 | |
| 294 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#Send().("Rate limited message", nil) |
| 295 | |
| 296 | 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) |
| 297 | mockClient.AssertNumberOfCallsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertNumberOfCalls().(t, "Do", 2) |
| 298 | |
| 299 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 300 | }) |
| 301 | } |
| 302 | |
| 303 | func TestContentTypeHeaderCompliancescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestContentTypeHeaderCompliance().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 304 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 305 | 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#) { |
| 306 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 307 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 308 | t, |
| 309 | "discord://test-token@test-webhook", |
| 310 | mockClient, |
| 311 | ) |
| 312 | |
| 313 | 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.). |
| 314 | 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/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 315 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 316 | |
| 317 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#Send().("Test message", nil) |
| 318 | |
| 319 | 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) |
| 320 | // Verify Content-Type header is set correctly |
| 321 | assertRequestMatchesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_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 { |
| 322 | return 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") == contentTypeJSONscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/contentTypeJSON. |
| 323 | }, "Content-Type header") |
| 324 | |
| 325 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 326 | }) |
| 327 | } |
| 328 | |
| 329 | func TestUserAgentHeaderCompliancescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestUserAgentHeaderCompliance().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 330 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 331 | 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#) { |
| 332 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 333 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 334 | t, |
| 335 | "discord://test-token@test-webhook", |
| 336 | mockClient, |
| 337 | ) |
| 338 | |
| 339 | 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.). |
| 340 | 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/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 341 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 342 | |
| 343 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#Send().("Test message", nil) |
| 344 | |
| 345 | 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) |
| 346 | // Verify User-Agent header is set |
| 347 | assertRequestMatchesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_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 { |
| 348 | return 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") != "" |
| 349 | }, "User-Agent header") |
| 350 | |
| 351 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 352 | }) |
| 353 | } |
| 354 | |
| 355 | func TestHTTPSRequirementCompliancescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/TestHTTPSRequirementCompliance().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 356 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 357 | 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#) { |
| 358 | mockClient := &MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#{} |
| 359 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 360 | t, |
| 361 | "discord://test-token@test-webhook", |
| 362 | mockClient, |
| 363 | ) |
| 364 | |
| 365 | // This should be tested by the service itself - all requests must use HTTPS |
| 366 | 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.). |
| 367 | 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/discord_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusNoContentscip-go gomod github.com/golang/go/src . `net/http`/StatusNoContent., ""), nil). |
| 368 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 369 | |
| 370 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#Send().("Test message", nil) |
| 371 | |
| 372 | 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) |
| 373 | assertRequestMatchesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_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 { |
| 374 | return req.URLscip-go gomod github.com/golang/go/src . `net/http`/Request#URL..Schemescip-go gomod github.com/golang/go/src . `net/url`/URL#Scheme. == "https" |
| 375 | }, "HTTPS scheme") |
| 376 | |
| 377 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 378 | }) |
| 379 | } |