| 1 | package mqtt_testscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/ |
| 2 | |
| 3 | import ( |
| 4 | "stringsscip-go gomod github.com/golang/go/src . strings/" |
| 5 | "testingscip-go gomod github.com/golang/go/src . testing/" |
| 6 | "testing/synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/" |
| 7 | |
| 8 | "github.com/stretchr/testify/mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/" |
| 9 | "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/" |
| 10 | ) |
| 11 | |
| 12 | func TestPublishEmptyMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/TestPublishEmptyMessage().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 13 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 14 | 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#) { |
| 15 | mockManager := &MockConnectionManagerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/MockConnectionManager#{} |
| 16 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("AwaitConnection", 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.).Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(nil) |
| 17 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Publish", 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., 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.). |
| 18 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockPublishResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createMockPublishResponse().(0), nil). |
| 19 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 20 | |
| 21 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createTestService().(t, "mqtt://broker.example.com/test/topic", mockManager) |
| 22 | |
| 23 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/mqtt`/Service#Send().("", nil) |
| 24 | 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) |
| 25 | |
| 26 | // Verify empty payload was sent |
| 27 | assertPublishPayloadscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/assertPublishPayload().(t, mockManager, "") |
| 28 | |
| 29 | mockManager.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 30 | }) |
| 31 | } |
| 32 | |
| 33 | func TestPublishVeryLongMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/TestPublishVeryLongMessage().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 34 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 35 | 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#) { |
| 36 | mockManager := &MockConnectionManagerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/MockConnectionManager#{} |
| 37 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("AwaitConnection", 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.).Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(nil) |
| 38 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Publish", 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., 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.). |
| 39 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockPublishResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createMockPublishResponse().(0), nil). |
| 40 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 41 | |
| 42 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createTestService().(t, "mqtt://broker.example.com/test/topic", mockManager) |
| 43 | |
| 44 | // Create a very long message (1MB) |
| 45 | longMessage := stringsscip-go gomod github.com/golang/go/src . strings/.Repeatscip-go gomod github.com/golang/go/src . strings/Repeat().("x", 1024*1024) |
| 46 | |
| 47 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/mqtt`/Service#Send().(longMessage, nil) |
| 48 | 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) |
| 49 | |
| 50 | // Verify the full payload was sent |
| 51 | assertPublishPayloadscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/assertPublishPayload().(t, mockManager, longMessage) |
| 52 | |
| 53 | mockManager.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 54 | }) |
| 55 | } |
| 56 | |
| 57 | func TestPublishSpecialCharactersInTopicscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/TestPublishSpecialCharactersInTopic().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 58 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 59 | 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#) { |
| 60 | tests := []struct { |
| 61 | name string |
| 62 | topic string |
| 63 | expectedTopic string |
| 64 | }{ |
| 65 | { |
| 66 | name: "topic with underscores", |
| 67 | topic: "test_topic_name", |
| 68 | expectedTopic: "test_topic_name", |
| 69 | }, |
| 70 | { |
| 71 | name: "topic with hyphens", |
| 72 | topic: "test-topic-name", |
| 73 | expectedTopic: "test-topic-name", |
| 74 | }, |
| 75 | { |
| 76 | name: "topic with numbers", |
| 77 | topic: "test123/topic456", |
| 78 | expectedTopic: "test123/topic456", |
| 79 | }, |
| 80 | { |
| 81 | name: "deep nested topic", |
| 82 | topic: "a/b/c/d/e/f/g/h", |
| 83 | expectedTopic: "a/b/c/d/e/f/g/h", |
| 84 | }, |
| 85 | } |
| 86 | |
| 87 | for _, tt := range tests { |
| 88 | mockManager := &MockConnectionManagerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/MockConnectionManager#{} |
| 89 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("AwaitConnection", 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.).Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(nil) |
| 90 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Publish", 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., 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.). |
| 91 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockPublishResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createMockPublishResponse().(0), nil). |
| 92 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 93 | |
| 94 | url := "mqtt://broker.example.com/" + tt.topic |
| 95 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createTestService().(t, url, mockManager) |
| 96 | |
| 97 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/mqtt`/Service#Send().("Test message", nil) |
| 98 | 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) |
| 99 | |
| 100 | assertPublishCalledscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/assertPublishCalled().(t, mockManager, tt.expectedTopic) |
| 101 | |
| 102 | mockManager.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 103 | } |
| 104 | }) |
| 105 | } |
| 106 | |
| 107 | func TestPublishUnicodeInMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/TestPublishUnicodeInMessage().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 108 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 109 | 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#) { |
| 110 | tests := []struct { |
| 111 | name string |
| 112 | message string |
| 113 | }{ |
| 114 | {"emoji", "Hello 👋 World 🌍"}, |
| 115 | {"chinese", "你好世界"}, |
| 116 | {"japanese", "こんにちは"}, |
| 117 | {"arabic", "مرحبا بالعالم"}, |
| 118 | {"russian", "Привет мир"}, |
| 119 | {"mixed unicode", "Hello 世界 🌍 Привет"}, |
| 120 | {"unicode with special chars", "Test™ © 2024 • ★ ♠"}, |
| 121 | } |
| 122 | |
| 123 | for _, tt := range tests { |
| 124 | mockManager := &MockConnectionManagerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/MockConnectionManager#{} |
| 125 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("AwaitConnection", 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.).Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(nil) |
| 126 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Publish", 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., 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.). |
| 127 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockPublishResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createMockPublishResponse().(0), nil). |
| 128 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 129 | |
| 130 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createTestService().(t, "mqtt://broker.example.com/test/topic", mockManager) |
| 131 | |
| 132 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/mqtt`/Service#Send().(tt.message, nil) |
| 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 | |
| 135 | assertPublishPayloadscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/assertPublishPayload().(t, mockManager, tt.message) |
| 136 | |
| 137 | mockManager.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 138 | } |
| 139 | }) |
| 140 | } |
| 141 | |
| 142 | func TestPublishNewlinesInMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/TestPublishNewlinesInMessage().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 143 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 144 | 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#) { |
| 145 | tests := []struct { |
| 146 | name string |
| 147 | message string |
| 148 | }{ |
| 149 | {"unix newlines", "Line1\nLine2\nLine3"}, |
| 150 | {"windows newlines", "Line1\r\nLine2\r\nLine3"}, |
| 151 | {"mixed newlines", "Line1\nLine2\r\nLine3"}, |
| 152 | {"only newlines", "\n\n\n"}, |
| 153 | } |
| 154 | |
| 155 | for _, tt := range tests { |
| 156 | mockManager := &MockConnectionManagerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/MockConnectionManager#{} |
| 157 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("AwaitConnection", 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.).Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(nil) |
| 158 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Publish", 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., 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.). |
| 159 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockPublishResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createMockPublishResponse().(0), nil). |
| 160 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 161 | |
| 162 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createTestService().(t, "mqtt://broker.example.com/test/topic", mockManager) |
| 163 | |
| 164 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/mqtt`/Service#Send().(tt.message, nil) |
| 165 | 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) |
| 166 | |
| 167 | assertPublishPayloadscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/assertPublishPayload().(t, mockManager, tt.message) |
| 168 | |
| 169 | mockManager.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 170 | } |
| 171 | }) |
| 172 | } |
| 173 | |
| 174 | func TestPublishTabsInMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/TestPublishTabsInMessage().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 175 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 176 | 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#) { |
| 177 | mockManager := &MockConnectionManagerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/MockConnectionManager#{} |
| 178 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("AwaitConnection", 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.).Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(nil) |
| 179 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Publish", 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., 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.). |
| 180 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockPublishResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createMockPublishResponse().(0), nil). |
| 181 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 182 | |
| 183 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createTestService().(t, "mqtt://broker.example.com/test/topic", mockManager) |
| 184 | |
| 185 | message := "Column1\tColumn2\tColumn3" |
| 186 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/mqtt`/Service#Send().(message, nil) |
| 187 | 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) |
| 188 | |
| 189 | assertPublishPayloadscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/assertPublishPayload().(t, mockManager, message) |
| 190 | |
| 191 | mockManager.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 192 | }) |
| 193 | } |
| 194 | |
| 195 | func TestPublishJSONMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/TestPublishJSONMessage().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 196 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 197 | 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#) { |
| 198 | mockManager := &MockConnectionManagerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/MockConnectionManager#{} |
| 199 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("AwaitConnection", 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.).Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(nil) |
| 200 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Publish", 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., 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.). |
| 201 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockPublishResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createMockPublishResponse().(0), nil). |
| 202 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 203 | |
| 204 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createTestService().(t, "mqtt://broker.example.com/test/topic", mockManager) |
| 205 | |
| 206 | jsonMessage := `{"key": "value", "nested": {"array": [1, 2, 3]}}` |
| 207 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/mqtt`/Service#Send().(jsonMessage, nil) |
| 208 | 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) |
| 209 | |
| 210 | assertPublishPayloadscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/assertPublishPayload().(t, mockManager, jsonMessage) |
| 211 | |
| 212 | mockManager.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 213 | }) |
| 214 | } |
| 215 | |
| 216 | func TestPublishXMLMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/TestPublishXMLMessage().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 217 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 218 | 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#) { |
| 219 | mockManager := &MockConnectionManagerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/MockConnectionManager#{} |
| 220 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("AwaitConnection", 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.).Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(nil) |
| 221 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Publish", 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., 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.). |
| 222 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockPublishResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createMockPublishResponse().(0), nil). |
| 223 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 224 | |
| 225 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createTestService().(t, "mqtt://broker.example.com/test/topic", mockManager) |
| 226 | |
| 227 | xmlMessage := `<message><to>user</to><from>sender</from><body>Hello</body></message>` |
| 228 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/mqtt`/Service#Send().(xmlMessage, nil) |
| 229 | 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) |
| 230 | |
| 231 | assertPublishPayloadscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/assertPublishPayload().(t, mockManager, xmlMessage) |
| 232 | |
| 233 | mockManager.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 234 | }) |
| 235 | } |
| 236 | |
| 237 | func TestPublishHTMLEntitiesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/TestPublishHTMLEntities().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 238 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 239 | 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#) { |
| 240 | mockManager := &MockConnectionManagerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/MockConnectionManager#{} |
| 241 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("AwaitConnection", 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.).Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(nil) |
| 242 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Publish", 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., 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.). |
| 243 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockPublishResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createMockPublishResponse().(0), nil). |
| 244 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 245 | |
| 246 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createTestService().(t, "mqtt://broker.example.com/test/topic", mockManager) |
| 247 | |
| 248 | htmlMessage := "<tag> & \"quoted\" 'apostrophe'" |
| 249 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/mqtt`/Service#Send().(htmlMessage, nil) |
| 250 | 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) |
| 251 | |
| 252 | assertPublishPayloadscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/assertPublishPayload().(t, mockManager, htmlMessage) |
| 253 | |
| 254 | mockManager.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 255 | }) |
| 256 | } |
| 257 | |
| 258 | func TestPublishWhitespaceOnlyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/TestPublishWhitespaceOnly().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 259 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 260 | 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#) { |
| 261 | tests := []struct { |
| 262 | name string |
| 263 | message string |
| 264 | }{ |
| 265 | {"single space", " "}, |
| 266 | {"multiple spaces", " "}, |
| 267 | {"tabs", "\t\t\t"}, |
| 268 | {"mixed whitespace", " \t\n\r "}, |
| 269 | } |
| 270 | |
| 271 | for _, tt := range tests { |
| 272 | mockManager := &MockConnectionManagerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/MockConnectionManager#{} |
| 273 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("AwaitConnection", 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.).Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(nil) |
| 274 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Publish", 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., 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.). |
| 275 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockPublishResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createMockPublishResponse().(0), nil). |
| 276 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 277 | |
| 278 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createTestService().(t, "mqtt://broker.example.com/test/topic", mockManager) |
| 279 | |
| 280 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/mqtt`/Service#Send().(tt.message, nil) |
| 281 | 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) |
| 282 | |
| 283 | assertPublishPayloadscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/assertPublishPayload().(t, mockManager, tt.message) |
| 284 | |
| 285 | mockManager.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 286 | } |
| 287 | }) |
| 288 | } |
| 289 | |
| 290 | func TestPublishBinaryLikeDatascip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/TestPublishBinaryLikeData().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 291 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 292 | 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#) { |
| 293 | mockManager := &MockConnectionManagerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/MockConnectionManager#{} |
| 294 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("AwaitConnection", 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.).Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(nil) |
| 295 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Publish", 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., 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.). |
| 296 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockPublishResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createMockPublishResponse().(0), nil). |
| 297 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 298 | |
| 299 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createTestService().(t, "mqtt://broker.example.com/test/topic", mockManager) |
| 300 | |
| 301 | // Create a string with all byte values (simulating binary data) |
| 302 | var binaryLike stringsscip-go gomod github.com/golang/go/src . strings/.Builderscip-go gomod github.com/golang/go/src . strings/Builder# |
| 303 | for i := range 256 { |
| 304 | binaryLike.WriteBytescip-go gomod github.com/golang/go/src . strings/Builder#WriteByte().(byte(i)) |
| 305 | } |
| 306 | |
| 307 | message := binaryLike.Stringscip-go gomod github.com/golang/go/src . strings/Builder#String().() |
| 308 | |
| 309 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/mqtt`/Service#Send().(message, nil) |
| 310 | 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) |
| 311 | |
| 312 | assertPublishPayloadscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/assertPublishPayload().(t, mockManager, message) |
| 313 | |
| 314 | mockManager.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 315 | }) |
| 316 | } |
| 317 | |
| 318 | func TestPublishWithNilParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/TestPublishWithNilParams().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 319 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 320 | 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#) { |
| 321 | mockManager := &MockConnectionManagerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/MockConnectionManager#{} |
| 322 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("AwaitConnection", 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.).Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(nil) |
| 323 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Publish", 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., 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.). |
| 324 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockPublishResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createMockPublishResponse().(0), nil). |
| 325 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 326 | |
| 327 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createTestService().(t, "mqtt://broker.example.com/test/topic", mockManager) |
| 328 | |
| 329 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/mqtt`/Service#Send().("Test message", nil) |
| 330 | 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) |
| 331 | |
| 332 | mockManager.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 333 | }) |
| 334 | } |
| 335 | |
| 336 | func TestPublishWithEmptyParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/TestPublishWithEmptyParams().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 337 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 338 | 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#) { |
| 339 | mockManager := &MockConnectionManagerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/MockConnectionManager#{} |
| 340 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("AwaitConnection", 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.).Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(nil) |
| 341 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Publish", 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., 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.). |
| 342 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockPublishResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createMockPublishResponse().(0), nil). |
| 343 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 344 | |
| 345 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createTestService().(t, "mqtt://broker.example.com/test/topic", mockManager) |
| 346 | |
| 347 | params := createTestParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createTestParams().() |
| 348 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/mqtt`/Service#Send().("Test message", params) |
| 349 | 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) |
| 350 | |
| 351 | mockManager.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 352 | }) |
| 353 | } |
| 354 | |
| 355 | func TestPublishMultipleConcurrentMessagesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/TestPublishMultipleConcurrentMessages().(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 | mockManager := &MockConnectionManagerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/MockConnectionManager#{} |
| 359 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("AwaitConnection", 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.).Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(nil) |
| 360 | |
| 361 | // Set up mock for multiple concurrent publish calls |
| 362 | for range 5 { |
| 363 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Publish", 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., 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.). |
| 364 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockPublishResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createMockPublishResponse().(0), nil). |
| 365 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 366 | } |
| 367 | |
| 368 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createTestService().(t, "mqtt://broker.example.com/test/topic", mockManager) |
| 369 | |
| 370 | // Send multiple messages |
| 371 | done := make(chan error, 5) |
| 372 | |
| 373 | for i := range 5 { |
| 374 | go func(_ int) { |
| 375 | done <- service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/mqtt`/Service#Send().("Message", nil) |
| 376 | }(i) |
| 377 | } |
| 378 | |
| 379 | // Wait for all to complete |
| 380 | for range 5 { |
| 381 | err := <-done |
| 382 | 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) |
| 383 | } |
| 384 | |
| 385 | mockManager.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 386 | }) |
| 387 | } |
| 388 | |
| 389 | func TestPublishWithEscapedCharactersInURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/TestPublishWithEscapedCharactersInURL().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 390 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 391 | 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#) { |
| 392 | mockManager := &MockConnectionManagerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/MockConnectionManager#{} |
| 393 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("AwaitConnection", 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.).Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(nil) |
| 394 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Publish", 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., 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.). |
| 395 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockPublishResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createMockPublishResponse().(0), nil). |
| 396 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 397 | |
| 398 | // URL with percent-encoded characters in password |
| 399 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createTestService().( |
| 400 | t, |
| 401 | "mqtt://user:pass%[email protected]/test/topic", |
| 402 | mockManager, |
| 403 | ) |
| 404 | |
| 405 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/mqtt`/Service#Send().("Test message", nil) |
| 406 | 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) |
| 407 | |
| 408 | // Verify password was decoded correctly |
| 409 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(t, "pass@word", service.Configscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/mqtt`/Service#Config..Passwordscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/mqtt`/Config#Password.) |
| 410 | |
| 411 | mockManager.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 412 | }) |
| 413 | } |
| 414 | |
| 415 | func TestPublishWithPortInURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/TestPublishWithPortInURL().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 416 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 417 | 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#) { |
| 418 | mockManager := &MockConnectionManagerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/MockConnectionManager#{} |
| 419 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("AwaitConnection", 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.).Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(nil) |
| 420 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Publish", 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., 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.). |
| 421 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockPublishResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createMockPublishResponse().(0), nil). |
| 422 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 423 | |
| 424 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createTestService().(t, "mqtt://broker.example.com:1884/test/topic", mockManager) |
| 425 | |
| 426 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/mqtt`/Service#Send().("Test message", nil) |
| 427 | 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) |
| 428 | |
| 429 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Equal().(t, 1884, service.Configscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/mqtt`/Service#Config..Portscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/mqtt`/Config#Port.) |
| 430 | |
| 431 | mockManager.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 432 | }) |
| 433 | } |
| 434 | |
| 435 | func TestPublishDeepTopicPathscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/TestPublishDeepTopicPath().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 436 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 437 | 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#) { |
| 438 | mockManager := &MockConnectionManagerscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/MockConnectionManager#{} |
| 439 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("AwaitConnection", 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.).Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(nil) |
| 440 | mockManager.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Publish", 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., 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.). |
| 441 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockPublishResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createMockPublishResponse().(0), nil). |
| 442 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 443 | |
| 444 | // Very deep topic path |
| 445 | deepTopic := "level1/level2/level3/level4/level5/level6/level7/level8/level9/level10" |
| 446 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/createTestService().(t, "mqtt://broker.example.com/"+deepTopic, mockManager) |
| 447 | |
| 448 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/push/mqtt`/Service#Send().("Test message", nil) |
| 449 | 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) |
| 450 | |
| 451 | assertPublishCalledscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/mqtt_test`/assertPublishCalled().(t, mockManager, deepTopic) |
| 452 | |
| 453 | mockManager.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 454 | }) |
| 455 | } |