f
This commit is contained in:
21
internal/infrastructure/external/nuoer/crypto_test.go
vendored
Normal file
21
internal/infrastructure/external/nuoer/crypto_test.go
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
package nuoer
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestSign(t *testing.T) {
|
||||
body := map[string]string{
|
||||
"name": "张三",
|
||||
"mobile": "13290879000",
|
||||
"idCard": "330129199511153412",
|
||||
}
|
||||
secret := "secret"
|
||||
got := Sign(body, secret)
|
||||
if got == "" {
|
||||
t.Fatal("sign should not be empty")
|
||||
}
|
||||
// 文档示例:name张三mobile13290879000idCard330129199511153412secret
|
||||
want := genMD5("idCard330129199511153412mobile13290879000name张三secret")
|
||||
if got != want {
|
||||
t.Fatalf("sign mismatch: got %s want %s", got, want)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user