@@ -141,6 +141,35 @@ func AkSkSpec(ctx context.Context, urlStr string) func(c convey.C) {
141
141
convey .ShouldHaveLength (result .JSON200 , 6 )
142
142
})
143
143
})
144
+
145
+ c .Convey ("aksk usage" , func (c convey.C ) {
146
+ c .Convey ("success" , func (c convey.C ) {
147
+ aksk , err := createAksk (ctx , client )
148
+ convey .So (err , convey .ShouldBeNil )
149
+
150
+ cli , err := api .NewClient (urlStr + apiimpl .APIV1Prefix , api .AkSkOption (aksk .AccessKey , aksk .SecretKey ))
151
+ convey .So (err , convey .ShouldBeNil )
152
+
153
+ resp , err := cli .GetUserInfo (ctx )
154
+ convey .So (err , convey .ShouldBeNil )
155
+
156
+ user , err := api .ParseCreateRepositoryResponse (resp )
157
+ convey .So (err , convey .ShouldBeNil )
158
+ convey .ShouldEqual (user .JSON201 .Name , userName )
159
+ })
160
+ c .Convey ("wrong sk" , func (c convey.C ) {
161
+ aksk , err := createAksk (ctx , client )
162
+ convey .So (err , convey .ShouldBeNil )
163
+
164
+ _ , err = api .NewClient (urlStr + apiimpl .APIV1Prefix , api .AkSkOption (aksk .AccessKey , "fakesk" ))
165
+ convey .So (err , convey .ShouldNotBeNil )
166
+ })
167
+
168
+ c .Convey ("ak not exit" , func (c convey.C ) {
169
+ _ , err := api .NewClient (urlStr + apiimpl .APIV1Prefix , api .AkSkOption ("fakesk" , "fakesk" ))
170
+ convey .So (err , convey .ShouldNotBeNil )
171
+ })
172
+ })
144
173
}
145
174
}
146
175
0 commit comments