mirror of
https://github.com/labstack/echo.git
synced 2024-12-22 20:06:21 +02:00
d0ed5830c4
Signed-off-by: Vishal Rana <vr@labstack.com>
42 lines
643 B
Go
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())
|
|
}
|