summaryrefslogtreecommitdiffstats
path: root/integrations
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-01-09 14:15:14 +0100
committerzeripath <art27@cantab.net>2020-01-09 13:15:14 +0000
commit1080c768d33a2c4846467d2e2913df87237b8b23 (patch)
tree0c9fd7f0da7e53bb6eeffa65aec793823bd8eb89 /integrations
parent71fe01897743915b8fc8bb8d07f44ee6214d1e50 (diff)
downloadgitea-1080c768d33a2c4846467d2e2913df87237b8b23.tar.gz
gitea-1080c768d33a2c4846467d2e2913df87237b8b23.zip
[API] orgEditTeam make Fields optional (#9556)
* API: orgEditTeam make Fields optional * add TestCase * Update integrations/api_team_test.go * suggestions from lafriks use len() to check if string is empty Co-Authored-By: Lauris BH <lauris@nix.lv> * change ... * use Where not ID to get mssql * add return and code format * fix test * fix test ... null pointer exept * update specific colums * only specific colums too Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'integrations')
-rw-r--r--integrations/api_team_test.go24
1 files changed, 19 insertions, 5 deletions
diff --git a/integrations/api_team_test.go b/integrations/api_team_test.go
index be56e37edf..d893854470 100644
--- a/integrations/api_team_test.go
+++ b/integrations/api_team_test.go
@@ -71,19 +71,33 @@ func TestAPITeam(t *testing.T) {
teamID := apiTeam.ID
// Edit team.
+ editDescription := "team 1"
+ editFalse := false
teamToEdit := &api.EditTeamOption{
Name: "teamone",
- Description: "team 1",
- IncludesAllRepositories: false,
+ Description: &editDescription,
Permission: "admin",
+ IncludesAllRepositories: &editFalse,
Units: []string{"repo.code", "repo.pulls", "repo.releases"},
}
+
req = NewRequestWithJSON(t, "PATCH", fmt.Sprintf("/api/v1/teams/%d?token=%s", teamID, token), teamToEdit)
resp = session.MakeRequest(t, req, http.StatusOK)
DecodeJSON(t, resp, &apiTeam)
- checkTeamResponse(t, &apiTeam, teamToEdit.Name, teamToEdit.Description, teamToEdit.IncludesAllRepositories,
+ checkTeamResponse(t, &apiTeam, teamToEdit.Name, *teamToEdit.Description, *teamToEdit.IncludesAllRepositories,
+ teamToEdit.Permission, teamToEdit.Units)
+ checkTeamBean(t, apiTeam.ID, teamToEdit.Name, *teamToEdit.Description, *teamToEdit.IncludesAllRepositories,
+ teamToEdit.Permission, teamToEdit.Units)
+
+ // Edit team Description only
+ editDescription = "first team"
+ teamToEditDesc := api.EditTeamOption{Description: &editDescription}
+ req = NewRequestWithJSON(t, "PATCH", fmt.Sprintf("/api/v1/teams/%d?token=%s", teamID, token), teamToEditDesc)
+ resp = session.MakeRequest(t, req, http.StatusOK)
+ DecodeJSON(t, resp, &apiTeam)
+ checkTeamResponse(t, &apiTeam, teamToEdit.Name, *teamToEditDesc.Description, *teamToEdit.IncludesAllRepositories,
teamToEdit.Permission, teamToEdit.Units)
- checkTeamBean(t, apiTeam.ID, teamToEdit.Name, teamToEdit.Description, teamToEdit.IncludesAllRepositories,
+ checkTeamBean(t, apiTeam.ID, teamToEdit.Name, *teamToEditDesc.Description, *teamToEdit.IncludesAllRepositories,
teamToEdit.Permission, teamToEdit.Units)
// Read team.
@@ -91,7 +105,7 @@ func TestAPITeam(t *testing.T) {
req = NewRequestf(t, "GET", "/api/v1/teams/%d?token="+token, teamID)
resp = session.MakeRequest(t, req, http.StatusOK)
DecodeJSON(t, resp, &apiTeam)
- checkTeamResponse(t, &apiTeam, teamRead.Name, teamRead.Description, teamRead.IncludesAllRepositories,
+ checkTeamResponse(t, &apiTeam, teamRead.Name, *teamToEditDesc.Description, teamRead.IncludesAllRepositories,
teamRead.Authorize.String(), teamRead.GetUnitNames())
// Delete team.