summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/42wim/go-gitter/test_utils.go
blob: 6703da2e99ccbeaddcf09531611dafaeb845cd9d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package gitter

import (
	"net/http"
	"net/http/httptest"
	"net/url"
)

var (
	mux    *http.ServeMux
	gitter *Gitter
	server *httptest.Server
)

func setup() {
	mux = http.NewServeMux()
	server = httptest.NewServer(mux)

	gitter = New("abc")

	// Fake the API and Stream base URLs by using the test
	// server URL instead.
	url, _ := url.Parse(server.URL)
	gitter.config.apiBaseURL = url.String() + "/"
	gitter.config.streamBaseURL = url.String() + "/"
}

func teardown() {
	server.Close()
}