Skip to content

Commit 27120cb

Browse files
committed
add project id filter workspace exlusion test
1 parent b30078d commit 27120cb

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

workspace_integration_test.go

+17-5
Original file line numberDiff line numberDiff line change
@@ -218,25 +218,37 @@ func TestWorkspacesList(t *testing.T) {
218218
assert.Equal(t, 0, wl.TotalCount)
219219
})
220220

221-
t.Run("when filtering using project id", func(t *testing.T) {
221+
t.Run("when using project id filter to list included workspaces", func(t *testing.T) {
222+
// create a project in the orgTest
222223
p, pTestCleanup := createProject(t, client, orgTest)
223224
defer pTestCleanup()
224-
225225
// create a workspace with project
226226
w, wTestCleanup := createWorkspaceWithOptions(t, client, orgTest, WorkspaceCreateOptions{
227227
Name: String(randomString(t)),
228228
Project: p,
229229
})
230230
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
234233
wl, err := client.Workspaces.List(ctx, orgTest.Name, &WorkspaceListOptions{
235234
ProjectID: p.ID,
236235
})
237236
require.NoError(t, err)
238237
assert.Contains(t, wl.Items, w)
239238
})
239+
240+
t.Run("when using project id filter but workspaces are excluded", 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+
})
240252
}
241253

242254
func TestWorkspacesCreateTableDriven(t *testing.T) {

0 commit comments

Comments
 (0)