@@ -218,25 +218,37 @@ func TestWorkspacesList(t *testing.T) {
218
218
assert .Equal (t , 0 , wl .TotalCount )
219
219
})
220
220
221
- t .Run ("when filtering using project id" , func (t * testing.T ) {
221
+ t .Run ("when using project id filter and project contains workspaces" , func (t * testing.T ) {
222
+ // create a project in the orgTest
222
223
p , pTestCleanup := createProject (t , client , orgTest )
223
224
defer pTestCleanup ()
224
-
225
225
// create a workspace with project
226
226
w , wTestCleanup := createWorkspaceWithOptions (t , client , orgTest , WorkspaceCreateOptions {
227
227
Name : String (randomString (t )),
228
228
Project : p ,
229
229
})
230
230
defer wTestCleanup ()
231
- // Request a page number which is out of range. The result should
232
- // be successful, but return no results if the paging options are
233
- // properly passed along.
231
+
232
+ // List all the workspaces under the given ProjectID
234
233
wl , err := client .Workspaces .List (ctx , orgTest .Name , & WorkspaceListOptions {
235
234
ProjectID : p .ID ,
236
235
})
237
236
require .NoError (t , err )
238
237
assert .Contains (t , wl .Items , w )
239
238
})
239
+
240
+ t .Run ("when using project id filter but project contains no workspaces" , func (t * testing.T ) {
241
+ // create a project in the orgTest
242
+ p , pTestCleanup := createProject (t , client , orgTest )
243
+ defer pTestCleanup ()
244
+
245
+ // List all the workspaces under the given ProjectID
246
+ wl , err := client .Workspaces .List (ctx , orgTest .Name , & WorkspaceListOptions {
247
+ ProjectID : p .ID ,
248
+ })
249
+ require .NoError (t , err )
250
+ assert .Empty (t , wl .Items )
251
+ })
240
252
}
241
253
242
254
func TestWorkspacesCreateTableDriven (t * testing.T ) {
0 commit comments