@@ -1772,8 +1772,6 @@ func Test_GetPullRequestCheckRuns(t *testing.T) {
17721772 expectError bool
17731773 expectedCheckRuns * github.ListCheckRunsResults
17741774 expectedErrMsg string
1775- lockdownEnabled bool
1776- restPermission string
17771775 }{
17781776 {
17791777 name : "successful check runs fetch" ,
@@ -1825,64 +1823,17 @@ func Test_GetPullRequestCheckRuns(t *testing.T) {
18251823 expectError : true ,
18261824 expectedErrMsg : "failed to get check runs" ,
18271825 },
1828- {
1829- name : "lockdown enabled - author lacks push access" ,
1830- mockedClient : MockHTTPClientWithHandlers (map [string ]http.HandlerFunc {
1831- GetReposPullsByOwnerByRepoByPullNumber : mockResponse (t , http .StatusOK , & github.PullRequest {
1832- Number : github .Ptr (42 ),
1833- Head : & github.PullRequestBranch {SHA : github .Ptr ("abcd1234" )},
1834- User : & github.User {Login : github .Ptr ("reader" )},
1835- }),
1836- }),
1837- requestArgs : map [string ]any {
1838- "method" : "get_check_runs" ,
1839- "owner" : "owner" ,
1840- "repo" : "repo" ,
1841- "pullNumber" : float64 (42 ),
1842- },
1843- lockdownEnabled : true ,
1844- restPermission : "read" ,
1845- expectError : true ,
1846- expectedErrMsg : "access to pull request is restricted by lockdown mode" ,
1847- },
1848- {
1849- name : "lockdown enabled - author has push access" ,
1850- mockedClient : MockHTTPClientWithHandlers (map [string ]http.HandlerFunc {
1851- GetReposPullsByOwnerByRepoByPullNumber : mockResponse (t , http .StatusOK , & github.PullRequest {
1852- Number : github .Ptr (42 ),
1853- Head : & github.PullRequestBranch {SHA : github .Ptr ("abcd1234" )},
1854- User : & github.User {Login : github .Ptr ("writer" )},
1855- }),
1856- GetReposCommitsCheckRunsByOwnerByRepoByRef : mockResponse (t , http .StatusOK , mockCheckRuns ),
1857- }),
1858- requestArgs : map [string ]any {
1859- "method" : "get_check_runs" ,
1860- "owner" : "owner" ,
1861- "repo" : "repo" ,
1862- "pullNumber" : float64 (42 ),
1863- },
1864- lockdownEnabled : true ,
1865- restPermission : "write" ,
1866- expectError : false ,
1867- expectedCheckRuns : mockCheckRuns ,
1868- },
18691826 }
18701827
18711828 for _ , tc := range tests {
18721829 t .Run (tc .name , func (t * testing.T ) {
18731830 // Setup client with mock
18741831 client := mustNewGHClient (t , tc .mockedClient )
18751832 serverTool := PullRequestRead (translations .NullTranslationHelper )
1876-
1877- var restClient * github.Client
1878- if tc .lockdownEnabled {
1879- restClient = mockRESTPermissionServer (t , tc .restPermission , nil )
1880- }
1881-
18821833 deps := BaseDeps {
18831834 Client : client ,
1884- RepoAccessCache : stubRepoAccessCache (restClient , 5 * time .Minute ),
1885- Flags : stubFeatureFlags (map [string ]bool {"lockdown-mode" : tc . lockdownEnabled }),
1835+ RepoAccessCache : stubRepoAccessCache (nil , 5 * time .Minute ),
1836+ Flags : stubFeatureFlags (map [string ]bool {"lockdown-mode" : false }),
18861837 }
18871838 handler := serverTool .Handler (deps )
18881839
0 commit comments