aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/users
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-18 10:53:54 +0100
committerChocobozzz <me@florianbigard.com>2018-01-18 15:42:20 +0100
commitf05a1c30c15d2ae35c11e241ca039a72eeb7d6ad (patch)
tree6d90c0de5dd3ad506e738d447e4f396951ed5624 /server/tests/utils/users
parent1174a8479ab9ee47b3305d668fe757435057a298 (diff)
downloadPeerTube-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')
-rw-r--r--server/tests/utils/users/accounts.ts25
-rw-r--r--server/tests/utils/users/users.ts2
2 files changed, 25 insertions, 2 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
1import { expect } from 'chai' 3import { expect } from 'chai'
4import { existsSync } from 'fs'
5import { join } from 'path'
2import { Account } from '../../../../shared/models/actors' 6import { Account } from '../../../../shared/models/actors'
7import { readdirPromise } from '../../../helpers/core-utils'
8import { root } from '../index'
3import { makeGetRequest } from '../requests/requests' 9import { makeGetRequest } from '../requests/requests'
4 10
5function getAccountsList (url: string, sort = '-createdAt', statusCodeExpected = 200) { 11function 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
41async 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
37export { 59export {
38 getAccount, 60 getAccount,
39 expectAccountFollows, 61 expectAccountFollows,
40 getAccountsList 62 getAccountsList,
63 checkActorFilesWereRemoved
41} 64}
diff --git a/server/tests/utils/users/users.ts b/server/tests/utils/users/users.ts
index 12945a805..25351e2c7 100644
--- a/server/tests/utils/users/users.ts
+++ b/server/tests/utils/users/users.ts
@@ -11,7 +11,7 @@ function createUser (
11 password: string, 11 password: string,
12 videoQuota = 1000000, 12 videoQuota = 1000000,
13 role: UserRole = UserRole.USER, 13 role: UserRole = UserRole.USER,
14 specialStatus = 204 14 specialStatus = 200
15) { 15) {
16 const path = '/api/v1/users' 16 const path = '/api/v1/users'
17 const body = { 17 const body = {