(t *testing.T)
| 52 | } |
| 53 | |
| 54 | func TestAuditLogDescription(t *testing.T) { |
| 55 | t.Parallel() |
| 56 | testCases := []struct { |
| 57 | name string |
| 58 | alog database.GetAuditLogsOffsetRow |
| 59 | want string |
| 60 | }{ |
| 61 | { |
| 62 | name: "mainline", |
| 63 | alog: database.GetAuditLogsOffsetRow{ |
| 64 | AuditLog: database.AuditLog{ |
| 65 | Action: database.AuditActionCreate, |
| 66 | StatusCode: 200, |
| 67 | ResourceType: database.ResourceTypeWorkspace, |
| 68 | }, |
| 69 | }, |
| 70 | want: "{user} created workspace {target}", |
| 71 | }, |
| 72 | { |
| 73 | name: "unsuccessful", |
| 74 | alog: database.GetAuditLogsOffsetRow{ |
| 75 | AuditLog: database.AuditLog{ |
| 76 | Action: database.AuditActionCreate, |
| 77 | StatusCode: 400, |
| 78 | ResourceType: database.ResourceTypeWorkspace, |
| 79 | }, |
| 80 | }, |
| 81 | want: "{user} unsuccessfully attempted to create workspace {target}", |
| 82 | }, |
| 83 | { |
| 84 | name: "login", |
| 85 | alog: database.GetAuditLogsOffsetRow{ |
| 86 | AuditLog: database.AuditLog{ |
| 87 | Action: database.AuditActionLogin, |
| 88 | StatusCode: 200, |
| 89 | ResourceType: database.ResourceTypeApiKey, |
| 90 | }, |
| 91 | }, |
| 92 | want: "{user} logged in", |
| 93 | }, |
| 94 | { |
| 95 | name: "unsuccessful_login", |
| 96 | alog: database.GetAuditLogsOffsetRow{ |
| 97 | AuditLog: database.AuditLog{ |
| 98 | Action: database.AuditActionLogin, |
| 99 | StatusCode: 401, |
| 100 | ResourceType: database.ResourceTypeApiKey, |
| 101 | }, |
| 102 | }, |
| 103 | want: "{user} unsuccessfully attempted to login", |
| 104 | }, |
| 105 | { |
| 106 | name: "gitsshkey", |
| 107 | alog: database.GetAuditLogsOffsetRow{ |
| 108 | AuditLog: database.AuditLog{ |
| 109 | Action: database.AuditActionDelete, |
| 110 | StatusCode: 200, |
| 111 | ResourceType: database.ResourceTypeGitSshKey, |
nothing calls this directly
no test coverage detected