-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathapplicationoffer_test.go
51 lines (44 loc) · 1.29 KB
/
applicationoffer_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
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright 2017 Canonical Ltd.
// Licensed under the LGPLv3, see LICENCE file for details.
package names_test
import (
gc "gopkg.in/check.v1"
"github.com/juju/names/v5"
)
type applicationOfferSuite struct{}
var _ = gc.Suite(&applicationOfferSuite{})
var parseApplicationOfferTagTests = []struct {
tag string
expected names.Tag
err error
}{{
tag: "",
err: names.InvalidTagError("", ""),
}, {
tag: "applicationoffer-f47ac10b-58cc-4372-a567-0e02b2c3d479",
expected: names.NewApplicationOfferTag("f47ac10b-58cc-4372-a567-0e02b2c3d479"),
}, {
tag: "dave",
err: names.InvalidTagError("dave", ""),
}, {
tag: "applicationoffer-dave/0",
err: names.InvalidTagError("applicationoffer-dave/0", names.ApplicationOfferTagKind),
}, {
tag: "applicationoffer",
err: names.InvalidTagError("applicationoffer", ""),
}, {
tag: "user-dave",
err: names.InvalidTagError("user-dave", names.ApplicationOfferTagKind),
}}
func (s *applicationOfferSuite) TestParseApplicationOfferTag(c *gc.C) {
for i, t := range parseApplicationOfferTagTests {
c.Logf("test %d: %s", i, t.tag)
got, err := names.ParseApplicationOfferTag(t.tag)
if err != nil || t.err != nil {
c.Check(err, gc.DeepEquals, t.err)
continue
}
c.Check(got, gc.FitsTypeOf, t.expected)
c.Check(got, gc.Equals, t.expected)
}
}