| 1 | package matrix_testscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/matrix_test`/ |
| 2 | |
| 3 | import ( |
| 4 | "fmtscip-go gomod github.com/golang/go/src . fmt/" |
| 5 | "net/urlscip-go gomod github.com/golang/go/src . `net/url`/" |
| 6 | "testingscip-go gomod github.com/golang/go/src . testing/" |
| 7 | |
| 8 | "github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrixscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/" |
| 9 | ) |
| 10 | |
| 11 | // testLogger implements types.StdLogger for testing. |
| 12 | type testLoggerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/matrix_test`/testLogger# struct { |
| 13 | messagesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/matrix_test`/testLogger#messages. []string |
| 14 | } |
| 15 | |
| 16 | // Print logs an info message. |
| 17 | func (l *testLoggerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/matrix_test`/testLogger#) Printscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/matrix_test`/testLogger#Print().(v ...any) { |
| 18 | l.messagesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/matrix_test`/testLogger#messages. = append(l.messagesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/matrix_test`/testLogger#messages., fmtscip-go gomod github.com/golang/go/src . fmt/.Sprintscip-go gomod github.com/golang/go/src . fmt/Sprint().(v...)) |
| 19 | } |
| 20 | |
| 21 | // Printf logs a formatted info message. |
| 22 | func (l *testLoggerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/matrix_test`/testLogger#) Printfscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/matrix_test`/testLogger#Printf().(format string, v ...any) { |
| 23 | l.messagesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/matrix_test`/testLogger#messages. = append(l.messagesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/matrix_test`/testLogger#messages., fmtscip-go gomod github.com/golang/go/src . fmt/.Sprintfscip-go gomod github.com/golang/go/src . fmt/Sprintf().(format, v...)) |
| 24 | } |
| 25 | |
| 26 | // Println logs an info message with newline. |
| 27 | func (l *testLoggerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/matrix_test`/testLogger#) Printlnscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/matrix_test`/testLogger#Println().(v ...any) { |
| 28 | l.messagesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/matrix_test`/testLogger#messages. = append(l.messagesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/matrix_test`/testLogger#messages., fmtscip-go gomod github.com/golang/go/src . fmt/.Sprintlnscip-go gomod github.com/golang/go/src . fmt/Sprintln().(v...)) |
| 29 | } |
| 30 | |
| 31 | // createTestService creates a matrix service with the given URL string. |
| 32 | // Uses the "dummy" URL special case to avoid actual client initialization. |
| 33 | func createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/matrix_test`/createTestService().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#, serviceURL string) (*matrixscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/.Servicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#, error) { |
| 34 | t.Helperscip-go gomod github.com/golang/go/src . testing/common#Helper().() |
| 35 | |
| 36 | parsedURL, err := urlscip-go gomod github.com/golang/go/src . `net/url`/.Parsescip-go gomod github.com/golang/go/src . `net/url`/Parse().(serviceURL) |
| 37 | if err != nil { |
| 38 | t.Fatalfscip-go gomod github.com/golang/go/src . testing/common#Fatalf().("failed to parse URL: %v", err) |
| 39 | } |
| 40 | |
| 41 | service := &matrixscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/.Servicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#{} |
| 42 | |
| 43 | err = service.Initializescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#Initialize().(parsedURL, &testLoggerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/matrix_test`/testLogger#{}) |
| 44 | if err != nil { |
| 45 | return nil, err |
| 46 | } |
| 47 | |
| 48 | return service, nil |
| 49 | } |