1
0
mirror of https://github.com/go-kratos/kratos.git synced 2026-05-22 10:15:24 +02:00

test(internal/context,internal/host) add test (#1334)

* test(internal/context,internal/host) add test
This commit is contained in:
yuemoxi
2021-08-25 23:56:28 +08:00
committed by GitHub
parent 925e55a04d
commit a67ec16bf0
7 changed files with 389 additions and 0 deletions
+9
View File
@@ -1,6 +1,7 @@
package form
import (
"github.com/go-kratos/kratos/v2/internal/test/testproto"
"testing"
"github.com/go-kratos/kratos/v2/encoding"
@@ -31,6 +32,14 @@ func TestFormCodecMarshal(t *testing.T) {
content, err = encoding.GetCodec(contentType).Marshal(req)
require.NoError(t, err)
require.Equal(t, []byte("username=kratos"), content)
m := testproto.TestModel{
Id: 1,
Name: "kratos",
}
content, err = encoding.GetCodec(contentType).Marshal(m)
require.NoError(t, err)
require.Equal(t, []byte("id=1&name=kratos"), content)
}
func TestFormCodecUnmarshal(t *testing.T) {