Files
ziti/controller/network/network_test.go
T
2020-09-25 11:01:58 -04:00

38 lines
982 B
Go

package network
import (
"github.com/stretchr/testify/require"
"testing"
)
func TestNetwork_parseServiceAndIdentity(t *testing.T) {
req := require.New(t)
identity, serviceId := parseIdentityAndService("hello")
req.Equal("", identity)
req.Equal("hello", serviceId)
identity, serviceId = parseIdentityAndService("@hello")
req.Equal("", identity)
req.Equal("hello", serviceId)
identity, serviceId = parseIdentityAndService("a@hello")
req.Equal("a", identity)
req.Equal("hello", serviceId)
identity, serviceId = parseIdentityAndService("bar@hello")
req.Equal("bar", identity)
req.Equal("hello", serviceId)
identity, serviceId = parseIdentityAndService("@@hello")
req.Equal("", identity)
req.Equal("@hello", serviceId)
identity, serviceId = parseIdentityAndService("a@@hello")
req.Equal("a", identity)
req.Equal("@hello", serviceId)
identity, serviceId = parseIdentityAndService("a@foo@hello")
req.Equal("a", identity)
req.Equal("foo@hello", serviceId)
}