MCPcopy Index your code
hub / github.com/github/github-mcp-server / Test_ProjectsGet_IFC_InsidersMode

Function Test_ProjectsGet_IFC_InsidersMode

pkg/github/projects_test.go:631–702  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

629}
630
631func Test_ProjectsGet_IFC_InsidersMode(t *testing.T) {
632 toolDef := ProjectsGet(translations.NullTranslationHelper)
633
634 t.Run("get_project uses project metadata label", func(t *testing.T) {
635 project := map[string]any{"id": 123, "node_id": "NODE1", "title": "Private Project", "public": false}
636 mockedClient := MockHTTPClientWithHandlers(map[string]http.HandlerFunc{
637 GetOrgsProjectsV2ByProject: mockResponse(t, http.StatusOK, project),
638 })
639 client := mustNewGHClient(t, mockedClient)
640 deps := BaseDeps{
641 Client: client,
642 featureChecker: featureCheckerFor(FeatureFlagIFCLabels),
643 }
644 handler := toolDef.Handler(deps)
645 request := createMCPRequest(map[string]any{
646 "method": "get_project",
647 "owner": "octo-org",
648 "owner_type": "org",
649 "project_number": float64(1),
650 })
651
652 result, err := handler(ContextWithDeps(context.Background(), deps), &request)
653 require.NoError(t, err)
654 require.False(t, result.IsError)
655
656 require.NotNil(t, result.Meta)
657 ifcMap := unmarshalIFC(t, result.Meta["ifc"])
658 assert.Equal(t, "trusted", ifcMap["integrity"])
659 assert.Equal(t, "private", ifcMap["confidentiality"])
660 })
661
662 t.Run("get_project_status_update uses GraphQL project visibility", func(t *testing.T) {
663 gqlMockedClient := githubv4mock.NewMockedHTTPClient(
664 githubv4mock.NewQueryMatcher(
665 statusUpdateNodeQuery{},
666 map[string]any{
667 "id": githubv4.ID("SU_abc123"),
668 },
669 githubv4mock.DataResponse(map[string]any{
670 "node": map[string]any{
671 "id": "SU_abc123",
672 "body": "On track",
673 "status": "ON_TRACK",
674 "createdAt": "2026-01-15T10:00:00Z",
675 "startDate": "2026-01-01",
676 "targetDate": "2026-03-01",
677 "creator": map[string]any{"login": "octocat"},
678 "project": map[string]any{"public": true},
679 },
680 }),
681 ),
682 )
683 deps := BaseDeps{
684 GQLClient: githubv4.NewClient(gqlMockedClient),
685 featureChecker: featureCheckerFor(FeatureFlagIFCLabels),
686 }
687 handler := toolDef.Handler(deps)
688 request := createMCPRequest(map[string]any{

Callers

nothing calls this directly

Calls 12

NewMockedHTTPClientFunction · 0.92
NewQueryMatcherFunction · 0.92
DataResponseFunction · 0.92
ProjectsGetFunction · 0.85
mockResponseFunction · 0.85
mustNewGHClientFunction · 0.85
featureCheckerForFunction · 0.85
createMCPRequestFunction · 0.85
ContextWithDepsFunction · 0.85
unmarshalIFCFunction · 0.85
HandlerMethod · 0.45

Tested by

no test coverage detected