Implement endpoint for APIv4: GET /users/{user_id}/audits (#5472)

Этот коммит содержится в:
Saturnino Abril
2017-02-21 21:07:57 +09:00
коммит произвёл George Goldberg
родитель 7068307a1c
Коммит 5c19d9be7f
7 изменённых файлов: 113 добавлений и 47 удалений

Просмотреть файл

@@ -811,7 +811,7 @@ func TestGetSessions(t *testing.T) {
user := th.BasicUser
Client.Login(user.Email, user.Password)
sessions, resp := Client.GetSessions(user.Id, "")
for _, session := range sessions {
if session.UserId != user.Id {
@@ -899,3 +899,28 @@ func TestRevokeSessions(t *testing.T) {
CheckNoError(t, resp)
}
func TestGetAudits(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
defer TearDown()
Client := th.Client
user := th.BasicUser
audits, resp := Client.GetAudits(user.Id, 0, 100, "")
for _, audit := range audits {
if audit.UserId != user.Id {
t.Fatal("user id does not match audit user id")
}
}
CheckNoError(t, resp)
_, resp = Client.GetAudits(th.BasicUser2.Id, 0, 100, "")
CheckForbiddenStatus(t, resp)
Client.Logout()
_, resp = Client.GetAudits(user.Id, 0, 100, "")
CheckUnauthorizedStatus(t, resp)
_, resp = th.SystemAdminClient.GetAudits(user.Id, 0, 100, "")
CheckNoError(t, resp)
}