Cloak/internal/client/state_test.go

21 lines
612 B
Go
Raw Normal View History

2019-01-20 23:47:10 +00:00
package client
import (
"bytes"
"testing"
)
func TestSSVtoJson(t *testing.T) {
2019-08-02 19:06:28 +00:00
ssv := "UID=iGAO85zysIyR4c09CyZSLdNhtP/ckcYu7nIPI082AHA=;PublicKey=IYoUzkle/T/kriE+Ufdm7AHQtIeGnBWbhhlTbmDpUUI=;ServerName=www.bing.com;NumConn=4;MaskBrowser=chrome;"
2019-01-20 23:47:10 +00:00
json := ssvToJson(ssv)
2019-08-02 19:06:28 +00:00
expected := []byte(`{"UID":"iGAO85zysIyR4c09CyZSLdNhtP/ckcYu7nIPI082AHA=","PublicKey":"IYoUzkle/T/kriE+Ufdm7AHQtIeGnBWbhhlTbmDpUUI=","ServerName":"www.bing.com","NumConn":4,"MaskBrowser":"chrome"}`)
2019-01-20 23:47:10 +00:00
if !bytes.Equal(expected, json) {
t.Error(
"For", "ssvToJson",
"expecting", string(expected),
"got", string(json),
)
}
}