pomerium/internal/encoding/mock_encoder_test.go
Bobby DeSimone d3d60d1055 all: support route scoped sessions
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2019-11-06 17:54:15 -08:00

26 lines
554 B
Go

package encoding // import "github.com/pomerium/pomerium/internal/encoding"
import (
"errors"
"testing"
)
func TestMockEncoder(t *testing.T) {
e := errors.New("err")
mc := MockEncoder{
MarshalResponse: []byte("MarshalResponse"),
MarshalError: e,
UnmarshalError: e,
}
s, err := mc.Marshal("test")
if err != e {
t.Error("unexpected Marshal error")
}
if string(s) != "MarshalResponse" {
t.Error("unexpected MarshalResponse error")
}
err = mc.Unmarshal([]byte("s"), "s")
if err != e {
t.Error("unexpected Unmarshal error")
}
}