mirror of
https://github.com/openziti/ziti.git
synced 2026-09-11 13:29:03 +00:00
38 lines
982 B
Go
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)
|
|
}
|