| 1 | package discord_testscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/ |
| 2 | |
| 3 | import ( |
| 4 | "bytesscip-go gomod github.com/golang/go/src . bytes/" |
| 5 | "ioscip-go gomod github.com/golang/go/src . io/" |
| 6 | "net/httpscip-go gomod github.com/golang/go/src . `net/http`/" |
| 7 | "net/urlscip-go gomod github.com/golang/go/src . `net/url`/" |
| 8 | "stringsscip-go gomod github.com/golang/go/src . strings/" |
| 9 | "testingscip-go gomod github.com/golang/go/src . testing/" |
| 10 | |
| 11 | "github.com/stretchr/testify/mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/" |
| 12 | |
| 13 | "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`/" |
| 14 | "github.com/nicholas-fedor/shoutrrr/pkg/typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/" |
| 15 | ) |
| 16 | |
| 17 | // MockHTTPClient is a testify mock that implements the HTTPClient interface. |
| 18 | type MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient# struct { |
| 19 | mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.Mockscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#Mock. |
| 20 | } |
| 21 | |
| 22 | // mockLogger is a simple logger implementation for testing. |
| 23 | type mockLoggerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/mockLogger# struct{} |
| 24 | |
| 25 | func (m *mockLoggerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/mockLogger#) Printscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/mockLogger#Print().(_ ...any) {} |
| 26 | func (m *mockLoggerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/mockLogger#) Printfscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/mockLogger#Printf().(_ string, _ ...any) {} |
| 27 | func (m *mockLoggerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/mockLogger#) Printlnscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/mockLogger#Println().(_ ...any) {} |
| 28 | |
| 29 | // createTestService creates a Discord service instance configured for testing. |
| 30 | func createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestService().( |
| 31 | t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#, |
| 32 | webhookURL string, |
| 33 | httpClients ...discordscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/.HTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/HTTPClient#, |
| 34 | ) *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# { |
| 35 | t.Helperscip-go gomod github.com/golang/go/src . testing/common#Helper().() |
| 36 | |
| 37 | 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#{} |
| 38 | |
| 39 | parsedURL, err := urlscip-go gomod github.com/golang/go/src . `net/url`/.Parsescip-go gomod github.com/golang/go/src . `net/url`/Parse().(webhookURL) |
| 40 | if err != nil { |
| 41 | t.Fatalfscip-go gomod github.com/golang/go/src . testing/common#Fatalf().("failed to parse webhook URL: %v", err) |
| 42 | } |
| 43 | |
| 44 | err = 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#{}) |
| 45 | if err != nil { |
| 46 | t.Fatalfscip-go gomod github.com/golang/go/src . testing/common#Fatalf().("failed to initialize service: %v", err) |
| 47 | } |
| 48 | |
| 49 | // Override the HTTPClient if provided (after Initialize sets the default) |
| 50 | if len(httpClients) > 0 && httpClients[0] != nil { |
| 51 | service.HTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord`/Service#HTTPClient. = httpClients[0] |
| 52 | } |
| 53 | |
| 54 | return service |
| 55 | } |
| 56 | |
| 57 | // createTestMessageItem creates a test MessageItem with the given text. |
| 58 | func createTestMessageItemscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestMessageItem().(text string) 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# { |
| 59 | return 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#{Textscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/MessageItem#Text.: text} |
| 60 | } |
| 61 | |
| 62 | // createTestMessageItemWithFile creates a test MessageItem with a file attachment. |
| 63 | func createTestMessageItemWithFilescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestMessageItemWithFile().(text, filename string, data []byte) 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# { |
| 64 | return 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#{ |
| 65 | Textscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/MessageItem#Text.: text, |
| 66 | Filescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/MessageItem#File.: &typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/.Filescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/File#{ |
| 67 | Namescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/File#Name.: filename, |
| 68 | Datascip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/File#Data.: data, |
| 69 | }, |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | // createTestParams creates test parameters with the given key-value pairs. |
| 74 | func createTestParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createTestParams().(pairs ...string) *typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/.Paramsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Params# { |
| 75 | params := make(typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/.Paramsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/Params#) |
| 76 | |
| 77 | for i := 0; i < len(pairs); i += 2 { |
| 78 | if i+1 < len(pairs) { |
| 79 | params[pairs[i]] = pairs[i+1] |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | return ¶ms |
| 84 | } |
| 85 | |
| 86 | func (m *MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#) Doscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#Do().(req *httpscip-go gomod github.com/golang/go/src . `net/http`/.Requestscip-go gomod github.com/golang/go/src . `net/http`/Request#) (*httpscip-go gomod github.com/golang/go/src . `net/http`/.Responsescip-go gomod github.com/golang/go/src . `net/http`/Response#, error) { |
| 87 | // Capture the request body before it's consumed |
| 88 | if req.Bodyscip-go gomod github.com/golang/go/src . `net/http`/Request#Body. != nil { |
| 89 | body, err := ioscip-go gomod github.com/golang/go/src . io/.ReadAllscip-go gomod github.com/golang/go/src . io/ReadAll().(req.Bodyscip-go gomod github.com/golang/go/src . `net/http`/Request#Body.) |
| 90 | if err == nil { |
| 91 | req.Bodyscip-go gomod github.com/golang/go/src . `net/http`/Request#Body. = ioscip-go gomod github.com/golang/go/src . io/.NopCloserscip-go gomod github.com/golang/go/src . io/NopCloser().(bytesscip-go gomod github.com/golang/go/src . bytes/.NewReaderscip-go gomod github.com/golang/go/src . bytes/NewReader().(body)) |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | args := m.Calledscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#Called().(req) |
| 96 | |
| 97 | if args.Getscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Arguments#Get().(0) == nil { |
| 98 | return nil, args.Errorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Arguments#Error().(1) |
| 99 | } |
| 100 | |
| 101 | return args.Getscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Arguments#Get().(0).(*httpscip-go gomod github.com/golang/go/src . `net/http`/.Responsescip-go gomod github.com/golang/go/src . `net/http`/Response#), args.Errorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Arguments#Error().(1) |
| 102 | } |
| 103 | |
| 104 | // createMockResponse creates a mock HTTP response with the given status code and body. |
| 105 | func createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/createMockResponse().(statusCode int, body string, headers ...map[string]string) *httpscip-go gomod github.com/golang/go/src . `net/http`/.Responsescip-go gomod github.com/golang/go/src . `net/http`/Response# { |
| 106 | resp := &httpscip-go gomod github.com/golang/go/src . `net/http`/.Responsescip-go gomod github.com/golang/go/src . `net/http`/Response#{ |
| 107 | StatusCodescip-go gomod github.com/golang/go/src . `net/http`/Response#StatusCode.: statusCode, |
| 108 | Bodyscip-go gomod github.com/golang/go/src . `net/http`/Response#Body.: ioscip-go gomod github.com/golang/go/src . io/.NopCloserscip-go gomod github.com/golang/go/src . io/NopCloser().(stringsscip-go gomod github.com/golang/go/src . strings/.NewReaderscip-go gomod github.com/golang/go/src . strings/NewReader().(body)), |
| 109 | Headerscip-go gomod github.com/golang/go/src . `net/http`/Response#Header.: make(httpscip-go gomod github.com/golang/go/src . `net/http`/.Headerscip-go gomod github.com/golang/go/src . `net/http`/Header#), |
| 110 | } |
| 111 | |
| 112 | if len(headers) > 0 && headers[0] != nil { |
| 113 | for k, v := range headers[0] { |
| 114 | resp.Headerscip-go gomod github.com/golang/go/src . `net/http`/Response#Header..Setscip-go gomod github.com/golang/go/src . `net/http`/Header#Set().(k, v) |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | return resp |
| 119 | } |
| 120 | |
| 121 | // assertRequestMade asserts that an HTTP POST request was made to the expected URL. |
| 122 | func assertRequestMadescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/assertRequestMade().( |
| 123 | t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#, |
| 124 | mockClient *MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#, |
| 125 | expectedURL string, |
| 126 | ) { |
| 127 | t.Helperscip-go gomod github.com/golang/go/src . testing/common#Helper().() |
| 128 | |
| 129 | found := false |
| 130 | |
| 131 | for i := range mockClient.Callsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#Calls. { |
| 132 | call := &mockClient.Callsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#Calls.[i] |
| 133 | if call.Methodscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Method. == "Do" { |
| 134 | req := call.Argumentsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Arguments.[0].(*httpscip-go gomod github.com/golang/go/src . `net/http`/.Requestscip-go gomod github.com/golang/go/src . `net/http`/Request#) |
| 135 | if 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. && req.URLscip-go gomod github.com/golang/go/src . `net/http`/Request#URL..Stringscip-go gomod github.com/golang/go/src . `net/url`/URL#String().() == expectedURL { |
| 136 | found = true |
| 137 | |
| 138 | break |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | if !found { |
| 144 | t.Errorfscip-go gomod github.com/golang/go/src . testing/common#Errorf().("Expected POST request to %s, but no matching call found", expectedURL) |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | // assertRequestContains asserts that the HTTP request body contains the expected content. |
| 149 | func assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/assertRequestContains().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#, mockClient *MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#, expectedContent string) { |
| 150 | t.Helperscip-go gomod github.com/golang/go/src . testing/common#Helper().() |
| 151 | |
| 152 | found := false |
| 153 | |
| 154 | for i := range mockClient.Callsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#Calls. { |
| 155 | call := &mockClient.Callsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#Calls.[i] |
| 156 | if call.Methodscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Method. == "Do" { |
| 157 | req := call.Argumentsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Arguments.[0].(*httpscip-go gomod github.com/golang/go/src . `net/http`/.Requestscip-go gomod github.com/golang/go/src . `net/http`/Request#) |
| 158 | |
| 159 | body, err := ioscip-go gomod github.com/golang/go/src . io/.ReadAllscip-go gomod github.com/golang/go/src . io/ReadAll().(req.Bodyscip-go gomod github.com/golang/go/src . `net/http`/Request#Body.) |
| 160 | if err != nil { |
| 161 | continue |
| 162 | } |
| 163 | // Reset the body for potential future reads |
| 164 | req.Bodyscip-go gomod github.com/golang/go/src . `net/http`/Request#Body. = ioscip-go gomod github.com/golang/go/src . io/.NopCloserscip-go gomod github.com/golang/go/src . io/NopCloser().(bytesscip-go gomod github.com/golang/go/src . bytes/.NewReaderscip-go gomod github.com/golang/go/src . bytes/NewReader().(body)) |
| 165 | if stringsscip-go gomod github.com/golang/go/src . strings/.Containsscip-go gomod github.com/golang/go/src . strings/Contains().(string(body), expectedContent) { |
| 166 | found = true |
| 167 | |
| 168 | break |
| 169 | } |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | if !found { |
| 174 | t.Errorfscip-go gomod github.com/golang/go/src . testing/common#Errorf().("Expected request body to contain %q, but no matching call found", expectedContent) |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | // assertRequestBody asserts that the HTTP request body exactly matches the expected content. |
| 179 | func assertRequestBodyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/assertRequestBody().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#, mockClient *MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#, expectedBody string) { |
| 180 | t.Helperscip-go gomod github.com/golang/go/src . testing/common#Helper().() |
| 181 | |
| 182 | found := false |
| 183 | |
| 184 | for i := range mockClient.Callsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#Calls. { |
| 185 | call := &mockClient.Callsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#Calls.[i] |
| 186 | if call.Methodscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Method. == "Do" { |
| 187 | req := call.Argumentsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Arguments.[0].(*httpscip-go gomod github.com/golang/go/src . `net/http`/.Requestscip-go gomod github.com/golang/go/src . `net/http`/Request#) |
| 188 | |
| 189 | body, err := ioscip-go gomod github.com/golang/go/src . io/.ReadAllscip-go gomod github.com/golang/go/src . io/ReadAll().(req.Bodyscip-go gomod github.com/golang/go/src . `net/http`/Request#Body.) |
| 190 | if err != nil { |
| 191 | continue |
| 192 | } |
| 193 | // Reset the body for potential future reads |
| 194 | req.Bodyscip-go gomod github.com/golang/go/src . `net/http`/Request#Body. = ioscip-go gomod github.com/golang/go/src . io/.NopCloserscip-go gomod github.com/golang/go/src . io/NopCloser().(bytesscip-go gomod github.com/golang/go/src . bytes/.NewReaderscip-go gomod github.com/golang/go/src . bytes/NewReader().(body)) |
| 195 | if string(body) == expectedBody { |
| 196 | found = true |
| 197 | |
| 198 | break |
| 199 | } |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | if !found { |
| 204 | t.Errorfscip-go gomod github.com/golang/go/src . testing/common#Errorf().("Expected request body to be %q, but no matching call found", expectedBody) |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | // assertRequestMatches asserts that at least one HTTP request matches the given predicate. |
| 209 | func assertRequestMatchesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/assertRequestMatches().( |
| 210 | t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#, |
| 211 | mockClient *MockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/discord_test`/MockHTTPClient#, |
| 212 | predicate func(*httpscip-go gomod github.com/golang/go/src . `net/http`/.Requestscip-go gomod github.com/golang/go/src . `net/http`/Request#) bool, |
| 213 | description string, |
| 214 | ) { |
| 215 | t.Helperscip-go gomod github.com/golang/go/src . testing/common#Helper().() |
| 216 | |
| 217 | found := false |
| 218 | |
| 219 | for i := range mockClient.Callsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#Calls. { |
| 220 | call := &mockClient.Callsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#Calls.[i] |
| 221 | if call.Methodscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Method. == "Do" { |
| 222 | req := call.Argumentsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Arguments.[0].(*httpscip-go gomod github.com/golang/go/src . `net/http`/.Requestscip-go gomod github.com/golang/go/src . `net/http`/Request#) |
| 223 | if predicate(req) { |
| 224 | found = true |
| 225 | |
| 226 | break |
| 227 | } |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | if !found { |
| 232 | t.Errorfscip-go gomod github.com/golang/go/src . testing/common#Errorf().("Expected request to match %s, but no matching call found", description) |
| 233 | } |
| 234 | } |