| 1 | package zulip_testscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/ |
| 2 | |
| 3 | import ( |
| 4 | "contextscip-go gomod github.com/golang/go/src . context/" |
| 5 | "net/httpscip-go gomod github.com/golang/go/src . `net/http`/" |
| 6 | "stringsscip-go gomod github.com/golang/go/src . strings/" |
| 7 | "testingscip-go gomod github.com/golang/go/src . testing/" |
| 8 | "testing/synctestscip-go gomod github.com/golang/go/src . `testing/synctest`/" |
| 9 | |
| 10 | "github.com/stretchr/testify/mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/" |
| 11 | "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/" |
| 12 | |
| 13 | "github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulipscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/" |
| 14 | "github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/" |
| 15 | ) |
| 16 | |
| 17 | func TestServiceSendPlainTextscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendPlainText().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 18 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 19 | 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#) { |
| 20 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 21 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 22 | t, |
| 23 | "zulip://[email protected]:[email protected]?stream=general&topic=announcements", |
| 24 | mockClient, |
| 25 | ) |
| 26 | |
| 27 | msgResp := createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`) |
| 28 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 29 | |
| 30 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("Hello, World!", nil) |
| 31 | |
| 32 | 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) |
| 33 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "content=Hello%2C+World%21") |
| 34 | |
| 35 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 36 | }) |
| 37 | } |
| 38 | |
| 39 | func TestServiceSendEmptyMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendEmptyMessage().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 40 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 41 | 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#) { |
| 42 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 43 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 44 | t, |
| 45 | "zulip://[email protected]:[email protected]?stream=general", |
| 46 | mockClient, |
| 47 | ) |
| 48 | |
| 49 | msgResp := createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`) |
| 50 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 51 | |
| 52 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("", nil) |
| 53 | |
| 54 | 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) |
| 55 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "content=") |
| 56 | |
| 57 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 58 | }) |
| 59 | } |
| 60 | |
| 61 | func TestServiceSendWithStreamParamscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendWithStreamParam().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 62 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 63 | 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#) { |
| 64 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 65 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 66 | t, |
| 67 | "zulip://[email protected]:[email protected]", |
| 68 | mockClient, |
| 69 | ) |
| 70 | |
| 71 | msgResp := createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`) |
| 72 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 73 | |
| 74 | params := createTestParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestParams().("stream", "general") |
| 75 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("Test message", params) |
| 76 | |
| 77 | 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) |
| 78 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "to=general") |
| 79 | |
| 80 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 81 | }) |
| 82 | } |
| 83 | |
| 84 | func TestServiceSendWithTopicParamscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendWithTopicParam().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 85 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 86 | 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#) { |
| 87 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 88 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 89 | t, |
| 90 | "zulip://[email protected]:[email protected]?stream=general", |
| 91 | mockClient, |
| 92 | ) |
| 93 | |
| 94 | msgResp := createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`) |
| 95 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 96 | |
| 97 | params := createTestParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestParams().("topic", "announcements") |
| 98 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("Test message", params) |
| 99 | |
| 100 | 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) |
| 101 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "topic=announcements") |
| 102 | |
| 103 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 104 | }) |
| 105 | } |
| 106 | |
| 107 | func TestServiceSendWithNilParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendWithNilParams().(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 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 111 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 112 | t, |
| 113 | "zulip://[email protected]:[email protected]?stream=general&topic=announcements", |
| 114 | mockClient, |
| 115 | ) |
| 116 | |
| 117 | msgResp := createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`) |
| 118 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 119 | |
| 120 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("Test message", nil) |
| 121 | |
| 122 | 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) |
| 123 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "to=general") |
| 124 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "topic=announcements") |
| 125 | |
| 126 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 127 | }) |
| 128 | } |
| 129 | |
| 130 | func TestServiceSendWithContextscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendWithContext().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 131 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 132 | 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#) { |
| 133 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 134 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 135 | t, |
| 136 | "zulip://[email protected]:[email protected]?stream=general", |
| 137 | mockClient, |
| 138 | ) |
| 139 | |
| 140 | msgResp := createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`) |
| 141 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 142 | |
| 143 | ctx := contextscip-go gomod github.com/golang/go/src . context/.Backgroundscip-go gomod github.com/golang/go/src . context/Background().() |
| 144 | err := service.SendWithContextscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#SendWithContext().(ctx, "Context message", nil) |
| 145 | |
| 146 | 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) |
| 147 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "content=Context+message") |
| 148 | |
| 149 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 150 | }) |
| 151 | } |
| 152 | |
| 153 | func TestServiceSendWithCancelledContextscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendWithCancelledContext().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 154 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 155 | 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#) { |
| 156 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 157 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 158 | t, |
| 159 | "zulip://[email protected]:[email protected]?stream=general", |
| 160 | mockClient, |
| 161 | ) |
| 162 | |
| 163 | // register succeeds (once), messages call gets the cancel (the ctx is for the send) |
| 164 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.AnythingOfTypescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/AnythingOfType().("*http.Request")). |
| 165 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`), nil). |
| 166 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 167 | |
| 168 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.AnythingOfTypescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/AnythingOfType().("*http.Request")). |
| 169 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(nil, contextscip-go gomod github.com/golang/go/src . context/.Canceledscip-go gomod github.com/golang/go/src . context/Canceled.). |
| 170 | Maybescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Maybe().() |
| 171 | |
| 172 | ctx, cancel := contextscip-go gomod github.com/golang/go/src . context/.WithCancelscip-go gomod github.com/golang/go/src . context/WithCancel().(contextscip-go gomod github.com/golang/go/src . context/.Backgroundscip-go gomod github.com/golang/go/src . context/Background().()) |
| 173 | cancel() |
| 174 | |
| 175 | err := service.SendWithContextscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#SendWithContext().(ctx, "Canceled message", nil) |
| 176 | |
| 177 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Errorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Error().(t, err) |
| 178 | |
| 179 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 180 | }) |
| 181 | } |
| 182 | |
| 183 | func TestServiceSendWithTitleParamscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendWithTitleParam().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 184 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 185 | 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#) { |
| 186 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 187 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 188 | t, |
| 189 | "zulip://[email protected]:[email protected]?stream=general", |
| 190 | mockClient, |
| 191 | ) |
| 192 | |
| 193 | msgResp := createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`) |
| 194 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 195 | |
| 196 | params := createTestParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestParams().("title", "Alert") |
| 197 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("Something happened", params) |
| 198 | |
| 199 | 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) |
| 200 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "topic=Alert") |
| 201 | |
| 202 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 203 | }) |
| 204 | } |
| 205 | |
| 206 | func TestServiceSendTitleAsTopicFallbackscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendTitleAsTopicFallback().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 207 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 208 | 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#) { |
| 209 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 210 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 211 | t, |
| 212 | "zulip://[email protected]:[email protected]?stream=general", |
| 213 | mockClient, |
| 214 | ) |
| 215 | |
| 216 | msgResp := createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`) |
| 217 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 218 | |
| 219 | params := createTestParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestParams().("title", "Fallback Topic") |
| 220 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("body content", params) |
| 221 | |
| 222 | 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) |
| 223 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "topic=Fallback+Topic") |
| 224 | |
| 225 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 226 | }) |
| 227 | } |
| 228 | |
| 229 | func TestServiceSendTitleDoesNotOverrideExplicitTopicscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendTitleDoesNotOverrideExplicitTopic().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 230 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 231 | 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#) { |
| 232 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 233 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 234 | t, |
| 235 | "zulip://[email protected]:[email protected]?stream=general&topic=explicit", |
| 236 | mockClient, |
| 237 | ) |
| 238 | |
| 239 | msgResp := createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`) |
| 240 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 241 | |
| 242 | params := createTestParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestParams().("title", "Notification Title") |
| 243 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("body content", params) |
| 244 | |
| 245 | 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) |
| 246 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "topic=explicit") |
| 247 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "content=Notification+Title") |
| 248 | |
| 249 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 250 | }) |
| 251 | } |
| 252 | |
| 253 | func TestServiceSendTitleExceedingTopicLimitscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendTitleExceedingTopicLimit().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 254 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 255 | 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#) { |
| 256 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 257 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 258 | t, |
| 259 | "zulip://[email protected]:[email protected]?stream=general", |
| 260 | mockClient, |
| 261 | ) |
| 262 | |
| 263 | longTitle := stringsscip-go gomod github.com/golang/go/src . strings/.Repeatscip-go gomod github.com/golang/go/src . strings/Repeat().("a", 61) |
| 264 | params := createTestParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestParams().("title", longTitle) |
| 265 | |
| 266 | // register happens; title-as-topic length check fails before messages Do |
| 267 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.AnythingOfTypescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/AnythingOfType().("*http.Request")). |
| 268 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`), nil). |
| 269 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 270 | |
| 271 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("body content", params) |
| 272 | |
| 273 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Errorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Error().(t, err) |
| 274 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/ErrorIs().(t, err, zulipscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/.ErrTopicTooLongscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/ErrTopicTooLong.) |
| 275 | |
| 276 | assertNoMessagesAPICallscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertNoMessagesAPICall().(t, mockClient) |
| 277 | }) |
| 278 | } |
| 279 | |
| 280 | func TestServiceSendWithBothTopicAndTitlescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendWithBothTopicAndTitle().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 281 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 282 | 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#) { |
| 283 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 284 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 285 | t, |
| 286 | "zulip://[email protected]:[email protected]?stream=general", |
| 287 | mockClient, |
| 288 | ) |
| 289 | |
| 290 | msgResp := createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`) |
| 291 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 292 | |
| 293 | params := createTestParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestParams().("topic", "my-topic", "title", "my-title") |
| 294 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("body content", params) |
| 295 | |
| 296 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 297 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "topic=my-topic") |
| 298 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "content=my-title%0A%0Abody+content") |
| 299 | |
| 300 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 301 | }) |
| 302 | } |
| 303 | |
| 304 | func TestServiceSendWithUnicodeMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendWithUnicodeMessage().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 305 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 306 | 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#) { |
| 307 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 308 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 309 | t, |
| 310 | "zulip://[email protected]:[email protected]?stream=general", |
| 311 | mockClient, |
| 312 | ) |
| 313 | |
| 314 | msgResp := createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`) |
| 315 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 316 | |
| 317 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("Hello 世界 🌍", nil) |
| 318 | |
| 319 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 320 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "content=") |
| 321 | |
| 322 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 323 | }) |
| 324 | } |
| 325 | |
| 326 | func TestServiceSendWithSpecialCharactersscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendWithSpecialCharacters().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 327 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 328 | 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#) { |
| 329 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 330 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 331 | t, |
| 332 | "zulip://[email protected]:[email protected]?stream=general", |
| 333 | mockClient, |
| 334 | ) |
| 335 | |
| 336 | msgResp := createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`) |
| 337 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 338 | |
| 339 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("Test <script>alert('xss')</script>", nil) |
| 340 | |
| 341 | 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) |
| 342 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "content=") |
| 343 | |
| 344 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 345 | }) |
| 346 | } |
| 347 | |
| 348 | func TestServiceSendWithLongMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendWithLongMessage().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 349 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 350 | 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#) { |
| 351 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 352 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 353 | t, |
| 354 | "zulip://[email protected]:[email protected]?stream=general", |
| 355 | mockClient, |
| 356 | ) |
| 357 | |
| 358 | longMessage := stringsscip-go gomod github.com/golang/go/src . strings/.Repeatscip-go gomod github.com/golang/go/src . strings/Repeat().("a", 10000) |
| 359 | |
| 360 | msgResp := createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`) |
| 361 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 362 | |
| 363 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().(longMessage, nil) |
| 364 | |
| 365 | 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) |
| 366 | |
| 367 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 368 | }) |
| 369 | } |
| 370 | |
| 371 | func TestServiceSendWithMessageExceedingLimitscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendWithMessageExceedingLimit().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 372 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 373 | 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#) { |
| 374 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 375 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 376 | t, |
| 377 | "zulip://[email protected]:[email protected]?stream=general", |
| 378 | mockClient, |
| 379 | ) |
| 380 | |
| 381 | longMessage := stringsscip-go gomod github.com/golang/go/src . strings/.Repeatscip-go gomod github.com/golang/go/src . strings/Repeat().("a", 10001) |
| 382 | |
| 383 | // only register (fetch) happens; size error before messages Do |
| 384 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.AnythingOfTypescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/AnythingOfType().("*http.Request")). |
| 385 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`), nil). |
| 386 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 387 | |
| 388 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().(longMessage, nil) |
| 389 | |
| 390 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Errorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Error().(t, err) |
| 391 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/ErrorIs().(t, err, zulipscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/.ErrMessageTooLongscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/ErrMessageTooLong.) |
| 392 | |
| 393 | assertNoMessagesAPICallscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertNoMessagesAPICall().(t, mockClient) |
| 394 | }) |
| 395 | } |
| 396 | |
| 397 | func TestServiceSendParamsDoNotMutateConfigscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendParamsDoNotMutateConfig().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 398 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 399 | 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#) { |
| 400 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 401 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 402 | t, |
| 403 | "zulip://[email protected]:[email protected]?stream=general&topic=original", |
| 404 | mockClient, |
| 405 | ) |
| 406 | |
| 407 | msgResp := createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`) |
| 408 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 409 | |
| 410 | params := createTestParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestParams().("topic", "modified") |
| 411 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("Test message", params) |
| 412 | |
| 413 | 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) |
| 414 | 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, "original", service.Configscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Config..Topicscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Config#Topic.) |
| 415 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "topic=modified") |
| 416 | |
| 417 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 418 | }) |
| 419 | } |
| 420 | |
| 421 | // --- New tests for direct message support and server-side limit fetching --- |
| 422 | |
| 423 | func TestServiceSendDirectMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendDirectMessage().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 424 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 425 | 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#) { |
| 426 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 427 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 428 | t, |
| 429 | "zulip://[email protected]:[email protected]", |
| 430 | mockClient, |
| 431 | ) |
| 432 | |
| 433 | msgResp := createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`) |
| 434 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 435 | |
| 436 | params := createTestParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestParams().("type", "direct", "to", "[email protected],[email protected]") |
| 437 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("Direct hello", params) |
| 438 | |
| 439 | 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) |
| 440 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "type=direct") |
| 441 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, `to=%5B%22user1%40example.com%22%2C%22user2%40example.com%22%5D`) |
| 442 | |
| 443 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 444 | }) |
| 445 | } |
| 446 | |
| 447 | func TestServiceSendDirectWithReadBySenderscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendDirectWithReadBySender().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 448 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 449 | 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#) { |
| 450 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 451 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 452 | t, |
| 453 | "zulip://[email protected]:[email protected]", |
| 454 | mockClient, |
| 455 | ) |
| 456 | |
| 457 | msgResp := createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`) |
| 458 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 459 | |
| 460 | params := createTestParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestParams().("type", "direct", "to", "[email protected]", "read_by_sender", "true") |
| 461 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("DM with read", params) |
| 462 | |
| 463 | 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) |
| 464 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "read_by_sender=true") |
| 465 | |
| 466 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 467 | }) |
| 468 | } |
| 469 | |
| 470 | func TestServiceSendInvalidMessageTypescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendInvalidMessageType().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 471 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 472 | 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#) { |
| 473 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 474 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 475 | t, |
| 476 | "zulip://[email protected]:[email protected]?stream=general", |
| 477 | mockClient, |
| 478 | ) |
| 479 | |
| 480 | // type validation happens before fetch, so no Do calls at all |
| 481 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("bad type", createTestParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestParams().("type", "foo")) |
| 482 | |
| 483 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Errorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Error().(t, err) |
| 484 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/ErrorIs().(t, err, zulipscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/.ErrInvalidMessageTypescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/ErrInvalidMessageType.) |
| 485 | |
| 486 | mockClient.AssertNotCalledscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertNotCalled().(t, "Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.AnythingOfTypescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/AnythingOfType().("*http.Request")) |
| 487 | }) |
| 488 | } |
| 489 | |
| 490 | func TestServiceSendMissingRecipientChannelscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendMissingRecipientChannel().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 491 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 492 | 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#) { |
| 493 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 494 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 495 | t, |
| 496 | "zulip://[email protected]:[email protected]", |
| 497 | mockClient, |
| 498 | ) |
| 499 | |
| 500 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.AnythingOfTypescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/AnythingOfType().("*http.Request")). |
| 501 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`), nil). |
| 502 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() // register only |
| 503 | |
| 504 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("no recipient", nil) |
| 505 | |
| 506 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Errorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Error().(t, err) |
| 507 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/ErrorIs().(t, err, zulipscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/.ErrMissingRecipientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/ErrMissingRecipient.) |
| 508 | |
| 509 | assertNoMessagesAPICallscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertNoMessagesAPICall().(t, mockClient) |
| 510 | }) |
| 511 | } |
| 512 | |
| 513 | func TestServiceSendMissingRecipientDirectscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendMissingRecipientDirect().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 514 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 515 | 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#) { |
| 516 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 517 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 518 | t, |
| 519 | "zulip://[email protected]:[email protected]", |
| 520 | mockClient, |
| 521 | ) |
| 522 | |
| 523 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.AnythingOfTypescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/AnythingOfType().("*http.Request")). |
| 524 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`), nil). |
| 525 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() // register only |
| 526 | |
| 527 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("dm no to", createTestParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestParams().("type", "direct")) |
| 528 | |
| 529 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Errorscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/Error().(t, err) |
| 530 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.ErrorIsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/ErrorIs().(t, err, zulipscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/.ErrMissingRecipientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/ErrMissingRecipient.) |
| 531 | |
| 532 | assertNoMessagesAPICallscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertNoMessagesAPICall().(t, mockClient) |
| 533 | }) |
| 534 | } |
| 535 | |
| 536 | func TestServiceSendUsesCustomServerLimitsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendUsesCustomServerLimits().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 537 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 538 | 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#) { |
| 539 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 540 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 541 | t, |
| 542 | "zulip://[email protected]:[email protected]?stream=general", |
| 543 | mockClient, |
| 544 | ) |
| 545 | |
| 546 | // first call: register returns custom limits (larger) |
| 547 | registerResp := createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"max_message_length": 20000, "max_topic_length": 120}`) |
| 548 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.AnythingOfTypescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/AnythingOfType().("*http.Request")). |
| 549 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(registerResp, nil). |
| 550 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 551 | |
| 552 | // second: messages |
| 553 | msgResp := createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`) |
| 554 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.AnythingOfTypescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/AnythingOfType().("*http.Request")). |
| 555 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(msgResp, nil). |
| 556 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 557 | |
| 558 | // 15000 byte message should be allowed with custom 20000 limit |
| 559 | longMsg := stringsscip-go gomod github.com/golang/go/src . strings/.Repeatscip-go gomod github.com/golang/go/src . strings/Repeat().("a", 15000) |
| 560 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().(longMsg, nil) |
| 561 | |
| 562 | 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) |
| 563 | |
| 564 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 565 | }) |
| 566 | } |
| 567 | |
| 568 | func TestServiceSendFallsBackToDefaultLimitsOnRegisterFailurescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestServiceSendFallsBackToDefaultLimitsOnRegisterFailure().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 569 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 570 | 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#) { |
| 571 | mockClient := mocksscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/.NewMockHTTPClientscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip/mocks`/NewMockHTTPClient().(t) |
| 572 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 573 | t, |
| 574 | "zulip://[email protected]:[email protected]?stream=general", |
| 575 | mockClient, |
| 576 | ) |
| 577 | |
| 578 | // register fails -> fallback to defaults (10000) |
| 579 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.AnythingOfTypescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/AnythingOfType().("*http.Request")). |
| 580 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusServiceUnavailablescip-go gomod github.com/golang/go/src . `net/http`/StatusServiceUnavailable., ""), nil). |
| 581 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 582 | |
| 583 | // the send should still happen (using default limit) |
| 584 | msgResp := createMockResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createMockResponse().(httpscip-go gomod github.com/golang/go/src . `net/http`/.StatusOKscip-go gomod github.com/golang/go/src . `net/http`/StatusOK., `{"result": "success"}`) |
| 585 | mockClient.Onscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#On().("Do", mockscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/.AnythingOfTypescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/AnythingOfType().("*http.Request")). |
| 586 | Returnscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Return().(msgResp, nil). |
| 587 | Oncescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Call#Once().() |
| 588 | |
| 589 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("short after fallback", nil) |
| 590 | |
| 591 | 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) |
| 592 | |
| 593 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 594 | }) |
| 595 | } |