You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-zello-client/client/types_test.go

40 lines
864 B
Go

package client_test
import (
"encoding/json"
"fmt"
"testing"
"git.cheetah.cat/tetrapack/go-zello-client/client"
)
func TestLoginMarshalling(t *testing.T) {
var err error
workLoginReq := client.ZelloLogonReq{
ZelloCommand: client.ZelloCommand{Command: "logon", Sequence: 1337},
Username: "username",
Password: "password",
Channels: []string{"chan1", "chan2"},
}
workBytes, err := json.Marshal(workLoginReq)
if err != nil {
t.Fatal(err)
}
fmt.Println(string(workBytes))
consLoginReq := client.ZelloLogonReq{
ZelloCommand: client.ZelloCommand{Command: "logon", Sequence: 1337},
Username: "username",
Password: "password",
Channels: []string{"consumer-chan1"},
AuthToken: "authToken",
}
consBytes, err := json.Marshal(consLoginReq)
if err != nil {
t.Fatal(err)
}
fmt.Println(string(consBytes))
}