harness-drone/handler/web/logout_test.go

26 lines
636 B
Go
Raw Normal View History

2019-02-19 23:56:41 +00:00
// Copyright 2019 Drone.IO Inc. All rights reserved.
// Use of this source code is governed by the Drone Non-Commercial License
// that can be found in the LICENSE file.
package web
import (
"net/http/httptest"
"testing"
)
func TestLogout(t *testing.T) {
w := httptest.NewRecorder()
r := httptest.NewRequest("GET", "/logout", nil)
HandleLogout().ServeHTTP(w, r)
if got, want := w.Code, 200; want != got {
t.Errorf("Want response code %d, got %d", want, got)
}
if got, want := w.Header().Get("Set-Cookie"), "_session_=deleted; Path=/; Max-Age=0"; want != got {
t.Errorf("Want response code %q, got %q", want, got)
}
}