1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-26 20:54:00 +02:00
echo/cookie_test.go
Vishal Rana d0ed5830c4 Test coverage for cookie.go and context.go
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-06-05 22:25:34 -07:00

42 lines
643 B
Go

package echo
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestCookie(t *testing.T) {
c := new(Cookie)
// Name
c.SetName("name")
assert.Equal(t, "name", c.Name())
// Value
c.SetValue("Jon Snow")
assert.Equal(t, "Jon Snow", c.Value())
// Path
c.SetPath("/")
assert.Equal(t, "/", c.Path())
// Domain
c.SetDomain("labstack.com")
assert.Equal(t, "labstack.com", c.Domain())
// Expires
now := time.Now()
c.SetExpires(now)
assert.Equal(t, now, c.Expires())
// Secure
c.SetSecure(true)
assert.Equal(t, true, c.Secure())
// HTTPOnly
c.SetHTTPOnly(true)
assert.Equal(t, true, c.HTTPOnly())
}