| 1 | package e2e_testscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/e2e/matrix_test`/ |
| 2 | |
| 3 | import ( |
| 4 | "net/urlscip-go gomod github.com/golang/go/src . `net/url`/" |
| 5 | "osscip-go gomod github.com/golang/go/src . os/" |
| 6 | |
| 7 | "github.com/onsi/ginkgo/v2scip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/" |
| 8 | "github.com/onsi/gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/" |
| 9 | |
| 10 | "github.com/nicholas-fedor/shoutrrr/internal/testutilsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/" |
| 11 | "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`/" |
| 12 | "github.com/nicholas-fedor/shoutrrr/pkg/typesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/types`/" |
| 13 | ) |
| 14 | |
| 15 | var _ = ginkgoscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/.Describescip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/Describe().("Matrix Service E2E Tests", func() { |
| 16 | ginkgoscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/.Describescip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/Describe().("Service Initialization", func() { |
| 17 | ginkgoscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/.Itscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/It().("should initialize with valid credentials from environment", func() { |
| 18 | // Use shared service if available, otherwise create new one |
| 19 | if sharedServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/e2e/matrix_test`/sharedService. != nil { |
| 20 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(sharedServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/e2e/matrix_test`/sharedService..Configscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#Config.).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.BeNilscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/BeNil().()) |
| 21 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(sharedServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/e2e/matrix_test`/sharedService..Configscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#Config..Hostscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Config#Host.).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.BeEmptyscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/BeEmpty().()) |
| 22 | |
| 23 | return |
| 24 | } |
| 25 | |
| 26 | serviceURL := buildServiceURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/e2e/matrix_test`/buildServiceURL().() |
| 27 | if serviceURL == "" { |
| 28 | ginkgoscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/.Skipscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/Skip().("Matrix server not configured, skipping test. " + |
| 29 | "Set SHOUTRRR_MATRIX_USER and SHOUTRRR_MATRIX_PASSWORD environment variables") |
| 30 | } |
| 31 | |
| 32 | parsedURL, err := urlscip-go gomod github.com/golang/go/src . `net/url`/.Parsescip-go gomod github.com/golang/go/src . `net/url`/Parse().(serviceURL) |
| 33 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 34 | |
| 35 | 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#{} |
| 36 | err = service.Initializescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#Initialize().(parsedURL, testutilsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/.TestLoggerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/TestLogger().()) |
| 37 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 38 | |
| 39 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(service.Configscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#Config.).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.BeNilscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/BeNil().()) |
| 40 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(service.Configscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#Config..Hostscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Config#Host.).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.BeEmptyscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/BeEmpty().()) |
| 41 | }) |
| 42 | |
| 43 | ginkgoscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/.Itscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/It().("should return error with invalid credentials", func() { |
| 44 | // Use a clearly invalid URL that will fail authentication |
| 45 | invalidURL := "matrix://invaliduser:invalidpassword@localhost:8008?disableTLS=true" |
| 46 | parsedURL, err := urlscip-go gomod github.com/golang/go/src . `net/url`/.Parsescip-go gomod github.com/golang/go/src . `net/url`/Parse().(invalidURL) |
| 47 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 48 | |
| 49 | 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#{} |
| 50 | err = service.Initializescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#Initialize().(parsedURL, testutilsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/.TestLoggerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/TestLogger().()) |
| 51 | |
| 52 | // Should fail because the user doesn't exist or password is wrong |
| 53 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).Toscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#To().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 54 | }) |
| 55 | |
| 56 | ginkgoscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/.Itscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/It().("should return error with missing host", func() { |
| 57 | invalidURL := "matrix://user:password@" |
| 58 | parsedURL, err := urlscip-go gomod github.com/golang/go/src . `net/url`/.Parsescip-go gomod github.com/golang/go/src . `net/url`/Parse().(invalidURL) |
| 59 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 60 | |
| 61 | 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#{} |
| 62 | err = service.Initializescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#Initialize().(parsedURL, testutilsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/.TestLoggerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/TestLogger().()) |
| 63 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).Toscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#To().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 64 | }) |
| 65 | |
| 66 | ginkgoscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/.Itscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/It().("should return error with missing credentials", func() { |
| 67 | invalidURL := "matrix://localhost:8008" |
| 68 | parsedURL, err := urlscip-go gomod github.com/golang/go/src . `net/url`/.Parsescip-go gomod github.com/golang/go/src . `net/url`/Parse().(invalidURL) |
| 69 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 70 | |
| 71 | 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#{} |
| 72 | err = service.Initializescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#Initialize().(parsedURL, testutilsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/.TestLoggerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/TestLogger().()) |
| 73 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).Toscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#To().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 74 | }) |
| 75 | }) |
| 76 | |
| 77 | ginkgoscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/.Describescip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/Describe().("Send Messages", func() { |
| 78 | ginkgoscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/.Itscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/It().("should send basic text message to Matrix room", func() { |
| 79 | // Use shared service if available |
| 80 | if sharedServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/e2e/matrix_test`/sharedService. != nil { |
| 81 | err := sharedServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/e2e/matrix_test`/sharedService..Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#Send().("E2E Test: Basic text message", nil) |
| 82 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 83 | |
| 84 | return |
| 85 | } |
| 86 | |
| 87 | serviceURL := buildServiceURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/e2e/matrix_test`/buildServiceURL().() |
| 88 | if serviceURL == "" { |
| 89 | ginkgoscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/.Skipscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/Skip().("Matrix server not configured, skipping test. " + |
| 90 | "Set SHOUTRRR_MATRIX_USER, SHOUTRRR_MATRIX_PASSWORD, and SHOUTRRR_MATRIX_ROOM environment variables") |
| 91 | } |
| 92 | |
| 93 | parsedURL, err := urlscip-go gomod github.com/golang/go/src . `net/url`/.Parsescip-go gomod github.com/golang/go/src . `net/url`/Parse().(serviceURL) |
| 94 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 95 | |
| 96 | 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#{} |
| 97 | err = service.Initializescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#Initialize().(parsedURL, testutilsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/.TestLoggerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/TestLogger().()) |
| 98 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 99 | |
| 100 | err = service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#Send().("E2E Test: Basic text message", nil) |
| 101 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 102 | }) |
| 103 | |
| 104 | ginkgoscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/.Itscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/It().("should send message with custom title", func() { |
| 105 | // Use shared service if available to avoid rate limit from new login |
| 106 | if sharedServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/e2e/matrix_test`/sharedService. != nil { |
| 107 | err := sharedServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/e2e/matrix_test`/sharedService..Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#Send().( |
| 108 | "E2E Test: Message with custom title", |
| 109 | &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#{"title": "TestNotification"}, |
| 110 | ) |
| 111 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 112 | |
| 113 | return |
| 114 | } |
| 115 | |
| 116 | serviceURL := buildServiceURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/e2e/matrix_test`/buildServiceURL().() |
| 117 | if serviceURL == "" { |
| 118 | ginkgoscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/.Skipscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/Skip().("Matrix server not configured, skipping test") |
| 119 | } |
| 120 | |
| 121 | // Fallback: create new service (hits rate limit - not recommended) |
| 122 | parsedURL, err := urlscip-go gomod github.com/golang/go/src . `net/url`/.Parsescip-go gomod github.com/golang/go/src . `net/url`/Parse().(serviceURL + "&title=TestNotification") |
| 123 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 124 | |
| 125 | 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#{} |
| 126 | err = service.Initializescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#Initialize().(parsedURL, testutilsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/.TestLoggerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/TestLogger().()) |
| 127 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 128 | |
| 129 | err = service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#Send().("E2E Test: Message with custom title", nil) |
| 130 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 131 | }) |
| 132 | |
| 133 | ginkgoscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/.Itscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/It().("should fail to send when client is not initialized", func() { |
| 134 | // Use dummy URL which skips client initialization |
| 135 | // Format: matrix://:password@host - password is empty, which triggers ErrMissingCredentials |
| 136 | // but this is handled differently - we need a URL that parses successfully but skips client init |
| 137 | dummyURL := "matrix://:[email protected]" |
| 138 | parsedURL, err := urlscip-go gomod github.com/golang/go/src . `net/url`/.Parsescip-go gomod github.com/golang/go/src . `net/url`/Parse().(dummyURL) |
| 139 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 140 | |
| 141 | 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#{} |
| 142 | err = service.Initializescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#Initialize().(parsedURL, testutilsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/.TestLoggerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/TestLogger().()) |
| 143 | // This should succeed because the dummy URL is detected and client is not initialized |
| 144 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 145 | |
| 146 | err = service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#Send().("This should fail", nil) |
| 147 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).Toscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#To().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 148 | }) |
| 149 | }) |
| 150 | |
| 151 | ginkgoscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/.Describescip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/Describe().("Service ID", func() { |
| 152 | ginkgoscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/.Itscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/It().("should return correct service ID", func() { |
| 153 | // Even with dummy URL, service ID should work |
| 154 | // Use format with empty username but password present: matrix://:password@host |
| 155 | dummyURL := "matrix://:[email protected]" |
| 156 | parsedURL, err := urlscip-go gomod github.com/golang/go/src . `net/url`/.Parsescip-go gomod github.com/golang/go/src . `net/url`/Parse().(dummyURL) |
| 157 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 158 | |
| 159 | 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#{} |
| 160 | err = service.Initializescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#Initialize().(parsedURL, testutilsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/.TestLoggerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/TestLogger().()) |
| 161 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 162 | |
| 163 | serviceID := service.GetIDscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#GetID().() |
| 164 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(serviceID).Toscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#To().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Equalscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Equal().("matrix")) |
| 165 | }) |
| 166 | }) |
| 167 | |
| 168 | ginkgoscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/.Describescip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/Describe().("Configuration", func() { |
| 169 | ginkgoscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/.Itscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/It().("should parse room aliases correctly", func() { |
| 170 | // Test that room aliases are handled with # prefix |
| 171 | serviceURL := buildServiceURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/e2e/matrix_test`/buildServiceURL().() |
| 172 | if serviceURL == "" { |
| 173 | ginkgoscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/.Skipscip-go gomod github.com/onsi/ginkgo/v2 v2.32.1 `github.com/onsi/ginkgo/v2`/Skip().("Matrix server not configured, skipping test") |
| 174 | } |
| 175 | |
| 176 | // Add room without # prefix |
| 177 | room := osscip-go gomod github.com/golang/go/src . os/.Getenvscip-go gomod github.com/golang/go/src . os/Getenv().("SHOUTRRR_MATRIX_ROOM") |
| 178 | if room == "" { |
| 179 | room = "testroom" |
| 180 | } |
| 181 | |
| 182 | // Build URL with room that needs prefix |
| 183 | parsedURL, err := urlscip-go gomod github.com/golang/go/src . `net/url`/.Parsescip-go gomod github.com/golang/go/src . `net/url`/Parse().("matrix://user:pass@localhost:8008?room=" + room + "&disableTLS=true") |
| 184 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(err).NotToscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#NotTo().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.HaveOccurredscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/HaveOccurred().()) |
| 185 | |
| 186 | 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#{} |
| 187 | err = service.Initializescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#Initialize().(parsedURL, testutilsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/.TestLoggerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/internal/testutils`/TestLogger().()) |
| 188 | // This may fail due to auth, but we can check config parsing |
| 189 | if err == nil { |
| 190 | gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Expectscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Expect().(service.Configscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Service#Config..Roomsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/matrix`/Config#Rooms.).Toscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega/types`/Assertion#To().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.Notscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/Not().(gomegascip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/.BeEmptyscip-go gomod github.com/onsi/gomega v1.42.1 `github.com/onsi/gomega`/BeEmpty().())) |
| 191 | } |
| 192 | }) |
| 193 | }) |
| 194 | }) |