-
Notifications
You must be signed in to change notification settings - Fork 0
/
id_test.go
38 lines (27 loc) · 836 Bytes
/
id_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package payload_test
import (
"github.com/juju/testing"
gc "gopkg.in/check.v1"
"github.com/juju/juju/payload"
)
var _ = gc.Suite(&idSuite{})
type idSuite struct {
testing.IsolationSuite
}
func (s *idSuite) TestParseIDFull(c *gc.C) {
name, id := payload.ParseID("a-payload/my-payload")
c.Check(name, gc.Equals, "a-payload")
c.Check(id, gc.Equals, "my-payload")
}
func (s *idSuite) TestParseIDNameOnly(c *gc.C) {
name, id := payload.ParseID("a-payload")
c.Check(name, gc.Equals, "a-payload")
c.Check(id, gc.Equals, "")
}
func (s *idSuite) TestParseIDExtras(c *gc.C) {
name, id := payload.ParseID("somecharm/0/a-payload/my-payload")
c.Check(name, gc.Equals, "somecharm")
c.Check(id, gc.Equals, "0/a-payload/my-payload")
}