@@ -15,7 +15,6 @@ import (
1515 "github.com/stretchr/testify/require"
1616)
1717
18-
1918// errorTransport is a http.RoundTripper that always returns an error.
2019type errorTransport struct {
2120 err error
@@ -333,18 +332,11 @@ func Test_repositoryResourceContentsHandler_NetworkError(t *testing.T) {
333332 httpClient := & http.Client {Transport : & errorTransport {err : networkErr }}
334333 client := github .NewClient (httpClient )
335334 mockRawClient := raw .NewClient (client , base )
336- handler := RepositoryResourceContentsHandler (stubGetClientFn (client ), stubGetRawClientFn (mockRawClient ))
335+ handler := RepositoryResourceContentsHandler (stubGetClientFn (client ), stubGetRawClientFn (mockRawClient ), repositoryResourceContentURITemplate )
337336
338- request := mcp.ReadResourceRequest {
339- Params : struct {
340- URI string `json:"uri"`
341- Arguments map [string ]any `json:"arguments,omitempty"`
342- }{
343- Arguments : map [string ]any {
344- "owner" : []string {"owner" },
345- "repo" : []string {"repo" },
346- "path" : []string {"README.md" },
347- },
337+ request := & mcp.ReadResourceRequest {
338+ Params : & mcp.ReadResourceParams {
339+ URI : "repo://owner/repo/contents/README.md" ,
348340 },
349341 }
350342
@@ -358,23 +350,22 @@ func Test_repositoryResourceContentsHandler_NetworkError(t *testing.T) {
358350func Test_GetRepositoryResourceContent (t * testing.T ) {
359351 mockRawClient := raw .NewClient (github .NewClient (nil ), & url.URL {})
360352 tmpl , _ := GetRepositoryResourceContent (nil , stubGetRawClientFn (mockRawClient ), translations .NullTranslationHelper )
361- require .Equal (t , "repo://{owner}/{repo}/contents{/path*}" , tmpl .URITemplate . Raw () )
353+ require .Equal (t , "repo://{owner}/{repo}/contents{/path*}" , tmpl .URITemplate )
362354}
363355
364356func Test_GetRepositoryResourceBranchContent (t * testing.T ) {
365357 mockRawClient := raw .NewClient (github .NewClient (nil ), & url.URL {})
366358 tmpl , _ := GetRepositoryResourceBranchContent (nil , stubGetRawClientFn (mockRawClient ), translations .NullTranslationHelper )
367- require .Equal (t , "repo://{owner}/{repo}/refs/heads/{branch}/contents{/path*}" , tmpl .URITemplate . Raw () )
359+ require .Equal (t , "repo://{owner}/{repo}/refs/heads/{branch}/contents{/path*}" , tmpl .URITemplate )
368360}
369361func Test_GetRepositoryResourceCommitContent (t * testing.T ) {
370362 mockRawClient := raw .NewClient (github .NewClient (nil ), & url.URL {})
371363 tmpl , _ := GetRepositoryResourceCommitContent (nil , stubGetRawClientFn (mockRawClient ), translations .NullTranslationHelper )
372- require .Equal (t , "repo://{owner}/{repo}/sha/{sha}/contents{/path*}" , tmpl .URITemplate . Raw () )
364+ require .Equal (t , "repo://{owner}/{repo}/sha/{sha}/contents{/path*}" , tmpl .URITemplate )
373365}
374366
375367func Test_GetRepositoryResourceTagContent (t * testing.T ) {
376368 mockRawClient := raw .NewClient (github .NewClient (nil ), & url.URL {})
377369 tmpl , _ := GetRepositoryResourceTagContent (nil , stubGetRawClientFn (mockRawClient ), translations .NullTranslationHelper )
378- require .Equal (t , "repo://{owner}/{repo}/refs/tags/{tag}/contents{/path*}" , tmpl .URITemplate . Raw () )
370+ require .Equal (t , "repo://{owner}/{repo}/refs/tags/{tag}/contents{/path*}" , tmpl .URITemplate )
379371}
380-
0 commit comments