2017-06-26 23:46:34 +02:00
|
|
|
// Copyright 2016-2017, Pulumi Corporation. All rights reserved.
|
2017-06-16 18:46:09 +02:00
|
|
|
|
|
|
|
package resource
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
2017-08-02 18:25:22 +02:00
|
|
|
"github.com/pulumi/pulumi-fabric/pkg/tokens"
|
2017-06-16 18:46:09 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestURNRoundTripping(t *testing.T) {
|
|
|
|
ns := tokens.QName("namespace")
|
2017-08-30 03:24:12 +02:00
|
|
|
alloc := tokens.PackageName("foo/bar/baz")
|
2017-06-16 18:46:09 +02:00
|
|
|
typ := tokens.Type("bang:boom/fizzle:MajorResource")
|
|
|
|
name := tokens.QName("a-swell-resource")
|
|
|
|
urn := NewURN(ns, alloc, typ, name)
|
|
|
|
assert.Equal(t, ns, urn.Namespace())
|
|
|
|
assert.Equal(t, alloc, urn.Alloc())
|
|
|
|
assert.Equal(t, typ, urn.Type())
|
|
|
|
assert.Equal(t, name, urn.Name())
|
|
|
|
}
|