github.com/aporeto-inc/trireme-lib@v10.358.0+incompatible/controller/pkg/claimsheader/bytes_test.go (about) 1 // +build !windows 2 3 package claimsheader 4 5 import ( 6 "testing" 7 8 . "github.com/smartystreets/goconvey/convey" 9 ) 10 11 func TestHeaderBytes(t *testing.T) { 12 13 Convey("Given I create a new header bytes", t, func() { 14 header := NewClaimsHeader( 15 OptionCompressionType(CompressionTypeV1), 16 OptionEncrypt(true), 17 OptionDatapathVersion(DatapathVersion1), 18 OptionPing(true), 19 ).ToBytes() 20 21 Convey("Then header bytes should not be nil", func() { 22 So(header, ShouldNotBeNil) 23 }) 24 25 Convey("Given I convert bytes to claims header", func() { 26 ch := header.ToClaimsHeader() 27 28 Convey("Then it should be equal", func() { 29 So(ch.compressionType, ShouldEqual, CompressionTypeV1) 30 So(ch.encrypt, ShouldEqual, true) 31 So(ch.datapathVersion, ShouldEqual, DatapathVersion1) 32 So(ch.ping, ShouldEqual, true) 33 }) 34 }) 35 }) 36 }