You've already forked agentic-coding-workflow
feat(workspace): add ListBranches method to WorkspaceService
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -450,3 +450,36 @@ func TestWorkspaceService_Update_DefaultBranch_SameValue_NoGitOps(t *testing.T)
|
||||
require.Empty(t, fg.fetchRemoteBranchCalls)
|
||||
require.Empty(t, fg.checkoutCalls)
|
||||
}
|
||||
|
||||
func TestWorkspaceService_ListBranches(t *testing.T) {
|
||||
t.Parallel()
|
||||
pa := &fakePA{pid: uuid.New(), canRead: true, canWrite: true}
|
||||
svc, repo := newSvc(t, pa, nil, &fakeGit{})
|
||||
caller := Caller{UserID: uuid.New()}
|
||||
|
||||
wsID := uuid.New()
|
||||
repo.wss[wsID] = &Workspace{
|
||||
ID: wsID, ProjectID: pa.pid, Slug: "ws1",
|
||||
DefaultBranch: "main", MainPath: "/data/ws1/main",
|
||||
}
|
||||
|
||||
branches, err := svc.ListBranches(context.Background(), caller, wsID)
|
||||
require.NoError(t, err)
|
||||
// fakeGit returns nil, nil → empty slice
|
||||
require.Nil(t, branches)
|
||||
}
|
||||
|
||||
func TestWorkspaceService_ListBranches_NoReadAccess(t *testing.T) {
|
||||
t.Parallel()
|
||||
pa := &fakePA{pid: uuid.New(), canRead: false, canWrite: false}
|
||||
svc, repo := newSvc(t, pa, nil, &fakeGit{})
|
||||
caller := Caller{UserID: uuid.New()}
|
||||
|
||||
wsID := uuid.New()
|
||||
repo.wss[wsID] = &Workspace{
|
||||
ID: wsID, ProjectID: pa.pid, Slug: "ws1",
|
||||
}
|
||||
|
||||
_, err := svc.ListBranches(context.Background(), caller, wsID)
|
||||
require.Error(t, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user