diff options
Diffstat (limited to 'shared')
-rw-r--r-- | shared/models/videos/index.ts | 1 | ||||
-rw-r--r-- | shared/models/videos/rate/account-video-rate.model.ts | 7 | ||||
-rw-r--r-- | shared/utils/index.ts | 1 | ||||
-rw-r--r-- | shared/utils/users/accounts.ts | 16 |
4 files changed, 24 insertions, 1 deletions
diff --git a/shared/models/videos/index.ts b/shared/models/videos/index.ts index 9cf861048..e3d78220e 100644 --- a/shared/models/videos/index.ts +++ b/shared/models/videos/index.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | export * from './rate/user-video-rate-update.model' | 1 | export * from './rate/user-video-rate-update.model' |
2 | export * from './rate/user-video-rate.model' | 2 | export * from './rate/user-video-rate.model' |
3 | export * from './rate/account-video-rate.model' | ||
3 | export * from './rate/user-video-rate.type' | 4 | export * from './rate/user-video-rate.type' |
4 | export * from './abuse/video-abuse-state.model' | 5 | export * from './abuse/video-abuse-state.model' |
5 | export * from './abuse/video-abuse-create.model' | 6 | export * from './abuse/video-abuse-create.model' |
diff --git a/shared/models/videos/rate/account-video-rate.model.ts b/shared/models/videos/rate/account-video-rate.model.ts new file mode 100644 index 000000000..e789367dc --- /dev/null +++ b/shared/models/videos/rate/account-video-rate.model.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | import { UserVideoRateType } from './user-video-rate.type' | ||
2 | import { Video } from '../video.model' | ||
3 | |||
4 | export interface AccountVideoRate { | ||
5 | video: Video | ||
6 | rating: UserVideoRateType | ||
7 | } | ||
diff --git a/shared/utils/index.ts b/shared/utils/index.ts index c09565d95..469546872 100644 --- a/shared/utils/index.ts +++ b/shared/utils/index.ts | |||
@@ -15,6 +15,7 @@ export * from './server/servers' | |||
15 | export * from './videos/services' | 15 | export * from './videos/services' |
16 | export * from './videos/video-playlists' | 16 | export * from './videos/video-playlists' |
17 | export * from './users/users' | 17 | export * from './users/users' |
18 | export * from './users/accounts' | ||
18 | export * from './videos/video-abuses' | 19 | export * from './videos/video-abuses' |
19 | export * from './videos/video-blacklist' | 20 | export * from './videos/video-blacklist' |
20 | export * from './videos/video-channels' | 21 | export * from './videos/video-channels' |
diff --git a/shared/utils/users/accounts.ts b/shared/utils/users/accounts.ts index 388eb6973..54d66ac2a 100644 --- a/shared/utils/users/accounts.ts +++ b/shared/utils/users/accounts.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | 1 | /* tslint:disable:no-unused-expression */ |
2 | 2 | ||
3 | import * as request from 'supertest' | ||
3 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
4 | import { existsSync, readdir } from 'fs-extra' | 5 | import { existsSync, readdir } from 'fs-extra' |
5 | import { join } from 'path' | 6 | import { join } from 'path' |
@@ -53,11 +54,24 @@ async function checkActorFilesWereRemoved (actorUUID: string, serverNumber: numb | |||
53 | } | 54 | } |
54 | } | 55 | } |
55 | 56 | ||
57 | function getAccountRatings (url: string, accountName: string, accessToken: string, statusCodeExpected = 200, query = {}) { | ||
58 | const path = '/api/v1/accounts/' + accountName + '/ratings' | ||
59 | |||
60 | return request(url) | ||
61 | .get(path) | ||
62 | .query(query) | ||
63 | .set('Accept', 'application/json') | ||
64 | .set('Authorization', 'Bearer ' + accessToken) | ||
65 | .expect(statusCodeExpected) | ||
66 | .expect('Content-Type', /json/) | ||
67 | } | ||
68 | |||
56 | // --------------------------------------------------------------------------- | 69 | // --------------------------------------------------------------------------- |
57 | 70 | ||
58 | export { | 71 | export { |
59 | getAccount, | 72 | getAccount, |
60 | expectAccountFollows, | 73 | expectAccountFollows, |
61 | getAccountsList, | 74 | getAccountsList, |
62 | checkActorFilesWereRemoved | 75 | checkActorFilesWereRemoved, |
76 | getAccountRatings | ||
63 | } | 77 | } |