single user token in server tests
This commit is contained in:
parent
3ba6f7fa0a
commit
656d1c7851
3 changed files with 7 additions and 4 deletions
|
@ -20,7 +20,8 @@ func TestGetParentID(t *testing.T) {
|
|||
cfg := config.Configuration{}
|
||||
store := mockstore.NewMockStore(ctrl)
|
||||
auth := auth.New(&cfg, store)
|
||||
wsserver := ws.NewServer(auth, true)
|
||||
sessionToken := "TESTTOKEN"
|
||||
wsserver := ws.NewServer(auth, sessionToken)
|
||||
webhook := webhook.NewClient(&cfg)
|
||||
app := New(&cfg, store, auth, wsserver, &mocks.FileBackend{}, webhook)
|
||||
|
||||
|
|
|
@ -63,10 +63,11 @@ type Client struct {
|
|||
HttpHeader map[string]string
|
||||
}
|
||||
|
||||
func NewClient(url string) *Client {
|
||||
func NewClient(url string, sessionToken string) *Client {
|
||||
url = strings.TrimRight(url, "/")
|
||||
headers := map[string]string{
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
"Authorization": "Bearer " + sessionToken,
|
||||
}
|
||||
return &Client{url, url + API_URL_SUFFIX, &http.Client{}, headers}
|
||||
}
|
||||
|
|
|
@ -27,13 +27,14 @@ func getTestConfig() *config.Configuration {
|
|||
}
|
||||
|
||||
func SetupTestHelper() *TestHelper {
|
||||
sessionToken := "TESTTOKEN"
|
||||
th := &TestHelper{}
|
||||
srv, err := server.New(getTestConfig(), true)
|
||||
srv, err := server.New(getTestConfig(), sessionToken)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
th.Server = srv
|
||||
th.Client = client.NewClient(srv.Config().ServerRoot)
|
||||
th.Client = client.NewClient(srv.Config().ServerRoot, sessionToken)
|
||||
|
||||
return th
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue