diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-18 10:53:54 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-18 15:42:20 +0100 |
commit | f05a1c30c15d2ae35c11e241ca039a72eeb7d6ad (patch) | |
tree | 6d90c0de5dd3ad506e738d447e4f396951ed5624 /server/tests/utils/users/accounts.ts | |
parent | 1174a8479ab9ee47b3305d668fe757435057a298 (diff) | |
download | PeerTube-f05a1c30c15d2ae35c11e241ca039a72eeb7d6ad.tar.gz PeerTube-f05a1c30c15d2ae35c11e241ca039a72eeb7d6ad.tar.zst PeerTube-f05a1c30c15d2ae35c11e241ca039a72eeb7d6ad.zip |
Don't show videos of remote instance after unfollow
Diffstat (limited to 'server/tests/utils/users/accounts.ts')
-rw-r--r-- | server/tests/utils/users/accounts.ts | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/server/tests/utils/users/accounts.ts b/server/tests/utils/users/accounts.ts index 0ec7992b3..a5c13c319 100644 --- a/server/tests/utils/users/accounts.ts +++ b/server/tests/utils/users/accounts.ts | |||
@@ -1,5 +1,11 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | ||
2 | |||
1 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { existsSync } from 'fs' | ||
5 | import { join } from 'path' | ||
2 | import { Account } from '../../../../shared/models/actors' | 6 | import { Account } from '../../../../shared/models/actors' |
7 | import { readdirPromise } from '../../../helpers/core-utils' | ||
8 | import { root } from '../index' | ||
3 | import { makeGetRequest } from '../requests/requests' | 9 | import { makeGetRequest } from '../requests/requests' |
4 | 10 | ||
5 | function getAccountsList (url: string, sort = '-createdAt', statusCodeExpected = 200) { | 11 | function getAccountsList (url: string, sort = '-createdAt', statusCodeExpected = 200) { |
@@ -32,10 +38,27 @@ async function expectAccountFollows (url: string, nameWithDomain: string, follow | |||
32 | expect(account.followingCount).to.equal(followingCount, message) | 38 | expect(account.followingCount).to.equal(followingCount, message) |
33 | } | 39 | } |
34 | 40 | ||
41 | async function checkActorFilesWereRemoved (actorUUID: string, serverNumber: number) { | ||
42 | const testDirectory = 'test' + serverNumber | ||
43 | |||
44 | for (const directory of [ 'avatars' ]) { | ||
45 | const directoryPath = join(root(), testDirectory, directory) | ||
46 | |||
47 | const directoryExists = existsSync(directoryPath) | ||
48 | expect(directoryExists).to.be.true | ||
49 | |||
50 | const files = await readdirPromise(directoryPath) | ||
51 | for (const file of files) { | ||
52 | expect(file).to.not.contain(actorUUID) | ||
53 | } | ||
54 | } | ||
55 | } | ||
56 | |||
35 | // --------------------------------------------------------------------------- | 57 | // --------------------------------------------------------------------------- |
36 | 58 | ||
37 | export { | 59 | export { |
38 | getAccount, | 60 | getAccount, |
39 | expectAccountFollows, | 61 | expectAccountFollows, |
40 | getAccountsList | 62 | getAccountsList, |
63 | checkActorFilesWereRemoved | ||
41 | } | 64 | } |