~juju-qa/ubuntu/xenial/juju/2.0-rc2

« back to all changes in this revision

Viewing changes to src/gopkg.in/juju/names.v2/cloudcredential_test.go

  • Committer: Nicholas Skaggs
  • Date: 2016-09-30 14:39:30 UTC
  • mfrom: (1.8.1)
  • Revision ID: nicholas.skaggs@canonical.com-20160930143930-vwwhrefh6ftckccy
import upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
                        cloud:     names.NewCloudTag("aws"),
37
37
                        owner:     names.NewUserTag("bob@remote"),
38
38
                        name:      "foo",
 
39
                }, {
 
40
                        input:     "aws/bob@remote/foo@somewhere.com",
 
41
                        canonical: "aws/bob@remote/foo@somewhere.com",
 
42
                        string:    "cloudcred-aws_bob@remote_foo@somewhere.com",
 
43
                        cloud:     names.NewCloudTag("aws"),
 
44
                        owner:     names.NewUserTag("bob@remote"),
 
45
                        name:      "foo@somewhere.com",
 
46
                }, {
 
47
                        input:     "aws/bob@remote/foo_bar",
 
48
                        canonical: "aws/bob@remote/foo_bar",
 
49
                        string:    `cloudcred-aws_bob@remote_foo%5fbar`,
 
50
                        cloud:     names.NewCloudTag("aws"),
 
51
                        owner:     names.NewUserTag("bob@remote"),
 
52
                        name:      "foo_bar",
39
53
                },
40
54
        } {
41
55
                c.Logf("test %d: %s", i, t.input)
75
89
                {"foo", true},
76
90
                {"f00b4r", true},
77
91
                {"foo-bar", true},
 
92
                {"foo@bar", true},
 
93
                {"foo_bar", true},
78
94
                {"123", false},
79
95
                {"0foo", false},
80
96
        } {
81
97
                c.Logf("test %d: %s", i, t.string)
82
 
                c.Assert(names.IsValidCloudCredentialName(t.string), gc.Equals, t.expect, gc.Commentf("%s", t.string))
 
98
                c.Check(names.IsValidCloudCredentialName(t.string), gc.Equals, t.expect, gc.Commentf("%s", t.string))
83
99
        }
84
100
}
85
101
 
98
114
                tag:      "cloudcred-aws-china_bob_foo-manchu",
99
115
                expected: names.NewCloudCredentialTag("aws-china/bob/foo-manchu"),
100
116
        }, {
 
117
                tag:      "cloudcred-aws-china_bob_foo@somewhere.com",
 
118
                expected: names.NewCloudCredentialTag("aws-china/bob/foo@somewhere.com"),
 
119
        }, {
 
120
                tag:      `cloudcred-aws-china_bob_foo%5fbar`,
 
121
                expected: names.NewCloudCredentialTag("aws-china/bob/foo_bar"),
 
122
        }, {
101
123
                tag: "foo",
102
124
                err: names.InvalidTagError("foo", ""),
103
125
        }, {