@@ -181,6 +181,8 @@ func TestTeamTokensRead(t *testing.T) {
181
181
tt , err := client .TeamTokens .Read (ctx , tmTest .ID )
182
182
require .NoError (t , err )
183
183
assert .NotEmpty (t , tt )
184
+ require .NotEmpty (t , tt .Team )
185
+ assert .Equal (t , tt .Team .ID , tmTest .ID )
184
186
185
187
ttTestCleanup ()
186
188
})
@@ -193,8 +195,10 @@ func TestTeamTokensRead(t *testing.T) {
193
195
194
196
tt , err := client .TeamTokens .Read (ctx , tmTest .ID )
195
197
require .NoError (t , err )
196
- assert .NotEmpty (t , tt )
198
+ require .NotEmpty (t , tt )
197
199
assert .Equal (t , tt .ExpiredAt , oneDayLater )
200
+ require .NotEmpty (t , tt .Team )
201
+ assert .Equal (t , tt .Team .ID , tmTest .ID )
198
202
199
203
ttTestCleanup ()
200
204
})
@@ -229,9 +233,11 @@ func TestTeamTokensReadByID(t *testing.T) {
229
233
230
234
tt , err := client .TeamTokens .ReadByID (ctx , token .ID )
231
235
require .NoError (t , err )
232
- assert .NotEmpty (t , tt )
236
+ require .NotEmpty (t , tt )
233
237
assert .Empty (t , tt .Description )
234
238
assert .Equal (t , tt .ExpiredAt , oneDayLater )
239
+ require .NotEmpty (t , tt .Team )
240
+ assert .Equal (t , tt .Team .ID , tmTest .ID )
235
241
})
236
242
237
243
t .Run ("with multiple team tokens" , func (t * testing.T ) {
@@ -244,9 +250,11 @@ func TestTeamTokensReadByID(t *testing.T) {
244
250
245
251
tt , err := client .TeamTokens .ReadByID (ctx , token .ID )
246
252
require .NoError (t , err )
247
- assert .NotEmpty (t , tt )
253
+ require .NotEmpty (t , tt )
248
254
assert .Equal (t , tt .Description , desc1 )
249
255
assert .Empty (t , tt .ExpiredAt )
256
+ require .NotEmpty (t , tt .Team )
257
+ assert .Equal (t , tt .Team .ID , tmTest .ID )
250
258
251
259
desc2 := fmt .Sprintf ("go-tfe-team-token-test-%s" , randomString (t ))
252
260
tokenWithExpiration , ttTestCleanup2 := createTeamTokenWithOptions (t , client , tmTest , TeamTokenCreateOptions {
@@ -257,9 +265,11 @@ func TestTeamTokensReadByID(t *testing.T) {
257
265
258
266
tt2 , err := client .TeamTokens .ReadByID (ctx , tokenWithExpiration .ID )
259
267
require .NoError (t , err )
260
- assert .NotEmpty (t , tt2 )
268
+ require .NotEmpty (t , tt2 )
261
269
assert .Equal (t , tt2 .Description , desc2 )
262
270
assert .Equal (t , tt2 .ExpiredAt , oneDayLater )
271
+ require .NotEmpty (t , tt .Team )
272
+ assert .Equal (t , tt .Team .ID , tmTest .ID )
263
273
})
264
274
265
275
t .Run ("when a token doesn't exists" , func (t * testing.T ) {
0 commit comments