- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.2k
Handle protection status errors for unprotected branches #2092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|  | @@ -1150,6 +1150,32 @@ func TestRepositoriesService_GetBranchProtection_noDismissalRestrictions(t *test | |||||
| } | ||||||
| } | ||||||
|  | ||||||
| func TestRepositoriesService_GetBranchProtection_branchNotProtected(t *testing.T) { | ||||||
| client, mux, _, teardown := setup() | ||||||
| defer teardown() | ||||||
|  | ||||||
| mux.HandleFunc("/repos/o/r/branches/b/protection", func(w http.ResponseWriter, r *http.Request) { | ||||||
| testMethod(t, r, "GET") | ||||||
|  | ||||||
| w.WriteHeader(http.StatusBadRequest) | ||||||
| fmt.Fprintf(w, `{ | ||||||
| "message": "Branch not protected", | ||||||
|          | ||||||
| "message": "Branch not protected", | |
| "message": githubBranchNotProtected, | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gmlewis I'm not sure if we'll be able to use a variable inside a raw string. Am I missing something..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whups, you are correct. Please use %v and the variable name in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, %q makes more sense here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @gmlewis. I've updated the PR with the suggested changes.
        
          
              
                Outdated
          
        
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "message": "Branch not protected", | |
| "message": githubBranchNotProtected, | 
        
          
              
                Outdated
          
        
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "message": "Branch not protected", | |
| "message": githubBranchNotProtected, | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gmlewis Thank you for suggesting this change. I certainly missed this simplification.