summaryrefslogtreecommitdiffstats
path: root/integrations
diff options
context:
space:
mode:
authorChristian Muehlhaeuser <muesli@gmail.com>2019-07-22 09:11:16 +0200
committerLunny Xiao <xiaolunwen@gmail.com>2019-07-22 15:11:16 +0800
commit12a098920c03d147959516fda59a6dd6fe474a3c (patch)
treec8f10ce5dc02731b0795895684734998605266ea /integrations
parentcc384d767e40caa84c58b259853d9cbaaaab33fe (diff)
downloadgitea-12a098920c03d147959516fda59a6dd6fe474a3c.tar.gz
gitea-12a098920c03d147959516fda59a6dd6fe474a3c.zip
Fixed ineffectual assignments in tests (#7553)
Just makes it a bit more obvious which values we want to test for, and which ones we want to ignore.
Diffstat (limited to 'integrations')
-rw-r--r--integrations/api_repo_edit_test.go16
-rw-r--r--integrations/api_team_test.go4
2 files changed, 10 insertions, 10 deletions
diff --git a/integrations/api_repo_edit_test.go b/integrations/api_repo_edit_test.go
index 3b2c916ab0..1231201b97 100644
--- a/integrations/api_repo_edit_test.go
+++ b/integrations/api_repo_edit_test.go
@@ -146,13 +146,13 @@ func TestAPIRepoEdit(t *testing.T) {
// reset repo in db
url = fmt.Sprintf("/api/v1/repos/%s/%s?token=%s", user2.Name, *repoEditOption.Name, token2)
req = NewRequestWithJSON(t, "PATCH", url, &origRepoEditOption)
- resp = session.MakeRequest(t, req, http.StatusOK)
+ _ = session.MakeRequest(t, req, http.StatusOK)
// Test editing a non-existing repo
name := "repodoesnotexist"
url = fmt.Sprintf("/api/v1/repos/%s/%s?token=%s", user2.Name, name, token2)
req = NewRequestWithJSON(t, "PATCH", url, &api.EditRepoOption{Name: &name})
- resp = session.MakeRequest(t, req, http.StatusNotFound)
+ _ = session.MakeRequest(t, req, http.StatusNotFound)
// Test editing repo16 by user4 who does not have write access
origRepoEditOption = getRepoEditOptionFromRepo(repo16)
@@ -166,18 +166,18 @@ func TestAPIRepoEdit(t *testing.T) {
repoEditOption = getNewRepoEditOption(origRepoEditOption)
url = fmt.Sprintf("/api/v1/repos/%s/%s", user2.Name, repo16.Name)
req = NewRequestWithJSON(t, "PATCH", url, &repoEditOption)
- resp = session.MakeRequest(t, req, http.StatusNotFound)
+ _ = session.MakeRequest(t, req, http.StatusNotFound)
// Test using access token for a private repo that the user of the token owns
origRepoEditOption = getRepoEditOptionFromRepo(repo16)
repoEditOption = getNewRepoEditOption(origRepoEditOption)
url = fmt.Sprintf("/api/v1/repos/%s/%s?token=%s", user2.Name, repo16.Name, token2)
req = NewRequestWithJSON(t, "PATCH", url, &repoEditOption)
- resp = session.MakeRequest(t, req, http.StatusOK)
+ _ = session.MakeRequest(t, req, http.StatusOK)
// reset repo in db
url = fmt.Sprintf("/api/v1/repos/%s/%s?token=%s", user2.Name, *repoEditOption.Name, token2)
req = NewRequestWithJSON(t, "PATCH", url, &origRepoEditOption)
- resp = session.MakeRequest(t, req, http.StatusOK)
+ _ = session.MakeRequest(t, req, http.StatusOK)
// Test making a repo public that is private
repo16 = models.AssertExistsAndLoadBean(t, &models.Repository{ID: 16}).(*models.Repository)
@@ -188,14 +188,14 @@ func TestAPIRepoEdit(t *testing.T) {
}
url = fmt.Sprintf("/api/v1/repos/%s/%s?token=%s", user2.Name, repo16.Name, token2)
req = NewRequestWithJSON(t, "PATCH", url, &repoEditOption)
- resp = session.MakeRequest(t, req, http.StatusOK)
+ _ = session.MakeRequest(t, req, http.StatusOK)
repo16 = models.AssertExistsAndLoadBean(t, &models.Repository{ID: 16}).(*models.Repository)
assert.False(t, repo16.IsPrivate)
// Make it private again
private = true
repoEditOption.Private = &private
req = NewRequestWithJSON(t, "PATCH", url, &repoEditOption)
- resp = session.MakeRequest(t, req, http.StatusOK)
+ _ = session.MakeRequest(t, req, http.StatusOK)
// Test using org repo "user3/repo3" where user2 is a collaborator
origRepoEditOption = getRepoEditOptionFromRepo(repo3)
@@ -206,7 +206,7 @@ func TestAPIRepoEdit(t *testing.T) {
// reset repo in db
url = fmt.Sprintf("/api/v1/repos/%s/%s?token=%s", user3.Name, *repoEditOption.Name, token2)
req = NewRequestWithJSON(t, "PATCH", url, &origRepoEditOption)
- resp = session.MakeRequest(t, req, http.StatusOK)
+ _ = session.MakeRequest(t, req, http.StatusOK)
// Test using org repo "user3/repo3" with no user token
origRepoEditOption = getRepoEditOptionFromRepo(repo3)
diff --git a/integrations/api_team_test.go b/integrations/api_team_test.go
index a884085f5c..a7c22d6ba1 100644
--- a/integrations/api_team_test.go
+++ b/integrations/api_team_test.go
@@ -41,10 +41,10 @@ func TestAPITeam(t *testing.T) {
session = loginUser(t, user2.Name)
token = getTokenForLoggedInUser(t, session)
req = NewRequestf(t, "GET", "/api/v1/teams/%d?token="+token, teamUser.TeamID)
- resp = session.MakeRequest(t, req, http.StatusForbidden)
+ _ = session.MakeRequest(t, req, http.StatusForbidden)
req = NewRequestf(t, "GET", "/api/v1/teams/%d", teamUser.TeamID)
- resp = session.MakeRequest(t, req, http.StatusUnauthorized)
+ _ = session.MakeRequest(t, req, http.StatusUnauthorized)
// Get an admin user able to create, update and delete teams.
user = models.AssertExistsAndLoadBean(t, &models.User{ID: 1}).(*models.User)