summaryrefslogtreecommitdiffstats
path: root/app/apptestlib.go
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2018-09-26 12:42:51 -0400
committerGitHub <noreply@github.com>2018-09-26 12:42:51 -0400
commit4e59a27293394b6d5529efd13ad711daebbc0eb3 (patch)
tree51094fc76cfc6295d136e4ebbefbc3cac19c650a /app/apptestlib.go
parent15d64fb201848002a25facc3bbffc9535a704df6 (diff)
downloadchat-4e59a27293394b6d5529efd13ad711daebbc0eb3.tar.gz
chat-4e59a27293394b6d5529efd13ad711daebbc0eb3.tar.bz2
chat-4e59a27293394b6d5529efd13ad711daebbc0eb3.zip
Move HTTPService and ConfigService into services package (#9422)
* Move HTTPService and ConfigService into utils package * Re-add StaticConfigService * Move config and http services into their own packages
Diffstat (limited to 'app/apptestlib.go')
-rw-r--r--app/apptestlib.go25
1 files changed, 3 insertions, 22 deletions
diff --git a/app/apptestlib.go b/app/apptestlib.go
index c0d2cfaa2..dcc1fa941 100644
--- a/app/apptestlib.go
+++ b/app/apptestlib.go
@@ -7,7 +7,6 @@ import (
"io"
"io/ioutil"
"net/http"
- "net/http/httptest"
"os"
"path/filepath"
"time"
@@ -21,6 +20,7 @@ import (
"github.com/mattermost/mattermost-server/store/sqlstore"
"github.com/mattermost/mattermost-server/store/storetest"
"github.com/mattermost/mattermost-server/utils"
+ "github.com/mattermost/mattermost-server/utils/testutils"
)
type TestHelper struct {
@@ -36,7 +36,7 @@ type TestHelper struct {
tempConfigPath string
tempWorkspace string
- MockedHTTPService *MockedHTTPService
+ MockedHTTPService *testutils.MockedHTTPService
}
type persistentTestStore struct {
@@ -168,7 +168,7 @@ func (me *TestHelper) InitSystemAdmin() *TestHelper {
}
func (me *TestHelper) MockHTTPService(handler http.Handler) *TestHelper {
- me.MockedHTTPService = MakeMockedHTTPService(handler)
+ me.MockedHTTPService = testutils.MakeMockedHTTPService(handler)
me.App.HTTPService = me.MockedHTTPService
return me
@@ -514,22 +514,3 @@ func (me *FakeClusterInterface) sendClearRoleCacheMessage() {
Event: model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_ROLES,
})
}
-
-type MockedHTTPService struct {
- Server *httptest.Server
-}
-
-func MakeMockedHTTPService(handler http.Handler) *MockedHTTPService {
- return &MockedHTTPService{
- Server: httptest.NewServer(handler),
- }
-}
-
-func (h *MockedHTTPService) MakeClient(trustURLs bool) *http.Client {
- return h.Server.Client()
-}
-
-func (h *MockedHTTPService) Close() {
- h.Server.CloseClientConnections()
- h.Server.Close()
-}