| 1 | package zulip_testscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/ |
| 2 | |
| 3 | import ( |
| 4 | "ioscip-go gomod github.com/golang/go/src . io/" |
| 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/requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/" |
| 11 | |
| 12 | "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`/" |
| 13 | ) |
| 14 | |
| 15 | const contentTypeFormscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/contentTypeForm. = "application/x-www-form-urlencoded" |
| 16 | |
| 17 | func TestAPIURLFormatCompliancescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestAPIURLFormatCompliance().(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 | 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"}`) |
| 22 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 23 | |
| 24 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 25 | t, |
| 26 | "zulip://[email protected]:[email protected]?stream=general&topic=announcements", |
| 27 | mockClient, |
| 28 | ) |
| 29 | |
| 30 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("Test message", 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 | assertRequestMatchesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestMatches().(t, mockClient, func(req *httpscip-go gomod github.com/golang/go/src . `net/http`/.Requestscip-go gomod github.com/golang/go/src . `net/http`/Request#) bool { |
| 34 | return req.URLscip-go gomod github.com/golang/go/src . `net/http`/Request#URL..Schemescip-go gomod github.com/golang/go/src . `net/url`/URL#Scheme. == "https" && |
| 35 | req.URLscip-go gomod github.com/golang/go/src . `net/http`/Request#URL..Hostscip-go gomod github.com/golang/go/src . `net/url`/URL#Host. == "zulip.example.com" && |
| 36 | req.URLscip-go gomod github.com/golang/go/src . `net/http`/Request#URL..Pathscip-go gomod github.com/golang/go/src . `net/url`/URL#Path. == "/api/v1/messages" |
| 37 | }, "Zulip API URL format") |
| 38 | |
| 39 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 40 | }) |
| 41 | } |
| 42 | |
| 43 | func TestAPIPayloadStructureCompliancescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestAPIPayloadStructureCompliance().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 44 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 45 | 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#) { |
| 46 | 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) |
| 47 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 48 | t, |
| 49 | "zulip://[email protected]:[email protected]?stream=general&topic=announcements", |
| 50 | mockClient, |
| 51 | ) |
| 52 | |
| 53 | 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"}`) |
| 54 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 55 | |
| 56 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("Test message", nil) |
| 57 | |
| 58 | 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) |
| 59 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "type=channel") |
| 60 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "to=general") |
| 61 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "topic=announcements") |
| 62 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "content=Test+message") |
| 63 | |
| 64 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 65 | }) |
| 66 | } |
| 67 | |
| 68 | func TestAPIPayloadDirectMessageCompliancescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestAPIPayloadDirectMessageCompliance().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 69 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 70 | 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#) { |
| 71 | 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) |
| 72 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 73 | t, |
| 74 | "zulip://[email protected]:[email protected]", |
| 75 | mockClient, |
| 76 | ) |
| 77 | |
| 78 | 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"}`) |
| 79 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 80 | |
| 81 | 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]") |
| 82 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("DM test", params) |
| 83 | |
| 84 | 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) |
| 85 | // to should be JSON array |
| 86 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "type=direct") |
| 87 | 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`) |
| 88 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "content=DM+test") |
| 89 | |
| 90 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 91 | }) |
| 92 | } |
| 93 | |
| 94 | func TestAPIContentTypeHeaderCompliancescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestAPIContentTypeHeaderCompliance().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 95 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 96 | 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#) { |
| 97 | 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) |
| 98 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 99 | t, |
| 100 | "zulip://[email protected]:[email protected]?stream=general", |
| 101 | mockClient, |
| 102 | ) |
| 103 | |
| 104 | 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"}`) |
| 105 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 106 | |
| 107 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("Test message", nil) |
| 108 | |
| 109 | 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) |
| 110 | assertRequestMatchesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestMatches().(t, mockClient, func(req *httpscip-go gomod github.com/golang/go/src . `net/http`/.Requestscip-go gomod github.com/golang/go/src . `net/http`/Request#) bool { |
| 111 | return req.Headerscip-go gomod github.com/golang/go/src . `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src . `net/http`/Header#Get().("Content-Type") == contentTypeFormscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/contentTypeForm. |
| 112 | }, "Content-Type header") |
| 113 | |
| 114 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 115 | }) |
| 116 | } |
| 117 | |
| 118 | func TestAPIMethodCompliancescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestAPIMethodCompliance().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 119 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 120 | 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#) { |
| 121 | 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) |
| 122 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 123 | t, |
| 124 | "zulip://[email protected]:[email protected]?stream=general", |
| 125 | mockClient, |
| 126 | ) |
| 127 | |
| 128 | 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"}`) |
| 129 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 130 | |
| 131 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("Test message", nil) |
| 132 | |
| 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 | assertRequestMatchesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestMatches().(t, mockClient, func(req *httpscip-go gomod github.com/golang/go/src . `net/http`/.Requestscip-go gomod github.com/golang/go/src . `net/http`/Request#) bool { |
| 135 | return req.Methodscip-go gomod github.com/golang/go/src . `net/http`/Request#Method. == httpscip-go gomod github.com/golang/go/src . `net/http`/.MethodPostscip-go gomod github.com/golang/go/src . `net/http`/MethodPost. |
| 136 | }, "POST method") |
| 137 | |
| 138 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 139 | }) |
| 140 | } |
| 141 | |
| 142 | func TestAPICredentialInURLCompliancescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestAPICredentialInURLCompliance().(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 | 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) |
| 146 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 147 | t, |
| 148 | "zulip://[email protected]:[email protected]?stream=general", |
| 149 | mockClient, |
| 150 | ) |
| 151 | |
| 152 | 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"}`) |
| 153 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 154 | |
| 155 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("Test message", nil) |
| 156 | |
| 157 | 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) |
| 158 | assertRequestMatchesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestMatches().(t, mockClient, func(req *httpscip-go gomod github.com/golang/go/src . `net/http`/.Requestscip-go gomod github.com/golang/go/src . `net/http`/Request#) bool { |
| 159 | return req.URLscip-go gomod github.com/golang/go/src . `net/http`/Request#URL..Userscip-go gomod github.com/golang/go/src . `net/url`/URL#User. != nil && |
| 160 | req.URLscip-go gomod github.com/golang/go/src . `net/http`/Request#URL..Userscip-go gomod github.com/golang/go/src . `net/url`/URL#User..Usernamescip-go gomod github.com/golang/go/src . `net/url`/Userinfo#Username().() == "[email protected]" |
| 161 | }, "credentials in URL") |
| 162 | |
| 163 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 164 | }) |
| 165 | } |
| 166 | |
| 167 | func TestAPIHTTPSCompliancescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestAPIHTTPSCompliance().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 168 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 169 | 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#) { |
| 170 | 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) |
| 171 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 172 | t, |
| 173 | "zulip://[email protected]:[email protected]?stream=general", |
| 174 | mockClient, |
| 175 | ) |
| 176 | |
| 177 | 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"}`) |
| 178 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 179 | |
| 180 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("Test message", nil) |
| 181 | |
| 182 | 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) |
| 183 | assertRequestMatchesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestMatches().(t, mockClient, func(req *httpscip-go gomod github.com/golang/go/src . `net/http`/.Requestscip-go gomod github.com/golang/go/src . `net/http`/Request#) bool { |
| 184 | return req.URLscip-go gomod github.com/golang/go/src . `net/http`/Request#URL..Schemescip-go gomod github.com/golang/go/src . `net/url`/URL#Scheme. == "https" |
| 185 | }, "HTTPS scheme") |
| 186 | |
| 187 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 188 | }) |
| 189 | } |
| 190 | |
| 191 | func TestAPIWithoutTopicCompliancescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestAPIWithoutTopicCompliance().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 192 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 193 | 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#) { |
| 194 | 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) |
| 195 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 196 | t, |
| 197 | "zulip://[email protected]:[email protected]?stream=general", |
| 198 | mockClient, |
| 199 | ) |
| 200 | |
| 201 | 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"}`) |
| 202 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 203 | |
| 204 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("Test message", nil) |
| 205 | |
| 206 | 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) |
| 207 | assertRequestMatchesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestMatches().(t, mockClient, func(req *httpscip-go gomod github.com/golang/go/src . `net/http`/.Requestscip-go gomod github.com/golang/go/src . `net/http`/Request#) bool { |
| 208 | body, readErr := ioscip-go gomod github.com/golang/go/src . io/.ReadAllscip-go gomod github.com/golang/go/src . io/ReadAll().(req.Bodyscip-go gomod github.com/golang/go/src . `net/http`/Request#Body.) |
| 209 | if readErr != nil { |
| 210 | return false |
| 211 | } |
| 212 | |
| 213 | req.Bodyscip-go gomod github.com/golang/go/src . `net/http`/Request#Body. = ioscip-go gomod github.com/golang/go/src . io/.NopCloserscip-go gomod github.com/golang/go/src . io/NopCloser().(stringsscip-go gomod github.com/golang/go/src . strings/.NewReaderscip-go gomod github.com/golang/go/src . strings/NewReader().(string(body))) |
| 214 | |
| 215 | return !stringsscip-go gomod github.com/golang/go/src . strings/.Containsscip-go gomod github.com/golang/go/src . strings/Contains().(string(body), "topic=") |
| 216 | }, "no topic when not configured") |
| 217 | |
| 218 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 219 | }) |
| 220 | } |
| 221 | |
| 222 | func TestAPIWithTopicCompliancescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestAPIWithTopicCompliance().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 223 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 224 | 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#) { |
| 225 | 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) |
| 226 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 227 | t, |
| 228 | "zulip://[email protected]:[email protected]?stream=general&topic=announcements", |
| 229 | mockClient, |
| 230 | ) |
| 231 | |
| 232 | 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"}`) |
| 233 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 234 | |
| 235 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("Test message", nil) |
| 236 | |
| 237 | 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) |
| 238 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "topic=announcements") |
| 239 | |
| 240 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 241 | }) |
| 242 | } |
| 243 | |
| 244 | func TestAPIDirectWithToOnlyNoStreamscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/TestAPIDirectWithToOnlyNoStream().(t *testingscip-go gomod github.com/golang/go/src . testing/.Tscip-go gomod github.com/golang/go/src . testing/T#) { |
| 245 | t.Parallelscip-go gomod github.com/golang/go/src . testing/T#Parallel().() |
| 246 | 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#) { |
| 247 | 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) |
| 248 | service := createTestServicescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestService().( |
| 249 | t, |
| 250 | "zulip://[email protected]:[email protected]", |
| 251 | mockClient, |
| 252 | ) |
| 253 | |
| 254 | 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"}`) |
| 255 | setupRegisterThenMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/setupRegisterThenMessage().(t, mockClient, msgResp) |
| 256 | |
| 257 | params := createTestParamsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/createTestParams().("type", "direct", "to", "[email protected]") |
| 258 | err := service.Sendscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/zulip`/Service#Send().("DM only-to", params) |
| 259 | |
| 260 | 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) |
| 261 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "type=direct") |
| 262 | assertRequestContainsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/testing/integration/zulip_test`/assertRequestContains().(t, mockClient, "to=%5B%22dm-user%40example.com%22%5D") |
| 263 | |
| 264 | mockClient.AssertExpectationsscip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/mock`/Mock#AssertExpectations().(t) |
| 265 | }) |
| 266 | } |