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
Add DeleteDeployment for Repositories #1555
Changes from all commits
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 |
---|---|---|
|
@@ -89,6 +89,32 @@ func TestRepositoriesService_CreateDeployment(t *testing.T) { | |
} | ||
} | ||
|
||
func TestRepositoriesService_DeleteDeployment(t *testing.T) { | ||
client, mux, _, teardown := setup() | ||
defer teardown() | ||
|
||
mux.HandleFunc("/repos/o/r/deployments/1", func(w http.ResponseWriter, r *http.Request) { | ||
testMethod(t, r, "DELETE") | ||
w.WriteHeader(http.StatusNoContent) | ||
}) | ||
|
||
resp, err := client.Repositories.DeleteDeployment(context.Background(), "o", "r", 1) | ||
if err != nil { | ||
t.Errorf("Repositories.DeleteDeployment returned error: %v", err) | ||
} | ||
if resp.StatusCode != http.StatusNoContent { | ||
t.Error("Repositories.DeleteDeployment should return a 204 status") | ||
} | ||
|
||
resp, err = client.Repositories.DeleteDeployment(context.Background(), "o", "r", 2) | ||
if err == nil { | ||
t.Error("Repositories.DeleteDeployment should return an error") | ||
} | ||
if resp.StatusCode != http.StatusNotFound { | ||
t.Error("Repositories.DeleteDeployment should return a 404 status") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From the API docs, it looks like it should return There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you, @nightlark. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case I was just adding a test for a non-existent deployment (id: 2), in an attempt to increase test coverage. |
||
} | ||
} | ||
|
||
func TestRepositoriesService_ListDeploymentStatuses(t *testing.T) { | ||
client, mux, _, teardown := setup() | ||
defer teardown() | ||
|
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.
This should be:
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.
Sure, I'll add a test for that status