Implementation endpoint for APIv4: GET /teams/name/{name} (#5473)
* APIv4: GET /teams/name/{name}
Signed-off-by: Saturnino Abril <saturnino.abril@gmail.com>
* reorganized test with SystemAdminClient
Signed-off-by: Saturnino Abril <saturnino.abril@gmail.com>
Этот коммит содержится в:
коммит произвёл
enahum
родитель
22118fafc8
Коммит
623560481b
@@ -114,6 +114,42 @@ func TestGetTeam(t *testing.T) {
|
||||
CheckNoError(t, resp)
|
||||
}
|
||||
|
||||
func TestGetTeamByName(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
defer TearDown()
|
||||
Client := th.Client
|
||||
team := th.BasicTeam
|
||||
|
||||
rteam, resp := Client.GetTeamByName(team.Name, "")
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if rteam.Name != team.Name {
|
||||
t.Fatal("wrong team")
|
||||
}
|
||||
|
||||
_, resp = Client.GetTeamByName("junk", "")
|
||||
CheckNotFoundStatus(t, resp)
|
||||
|
||||
_, resp = Client.GetTeamByName("", "")
|
||||
CheckNotFoundStatus(t, resp)
|
||||
|
||||
Client.Logout()
|
||||
_, resp = Client.GetTeamByName(team.Name, "")
|
||||
CheckUnauthorizedStatus(t, resp)
|
||||
|
||||
_, resp = th.SystemAdminClient.GetTeamByName(team.Name, "")
|
||||
CheckNoError(t, resp)
|
||||
|
||||
th.LoginTeamAdmin()
|
||||
|
||||
team2 := &model.Team{DisplayName: "Name", Name: GenerateTestTeamName(), Email: GenerateTestEmail(), Type: model.TEAM_INVITE}
|
||||
rteam2, _ := Client.CreateTeam(team2)
|
||||
|
||||
th.LoginBasic()
|
||||
_, resp = Client.GetTeamByName(rteam2.Name, "")
|
||||
CheckForbiddenStatus(t, resp)
|
||||
}
|
||||
|
||||
func TestGetTeamsForUser(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
defer TearDown()
|
||||
|
||||
Ссылка в новой задаче
Block a user