diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-16 09:04:35 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | 89d241a79c262b9775c233b73cff080043ebb5e6 (patch) | |
tree | cb3b6cb431d25d891ef4e02f66c61d252d17048f /server/tests/api/activitypub | |
parent | d23dd9fbfc4d26026352c10f81d2795ceaf2908a (diff) | |
download | PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.gz PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.zst PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.zip |
Shorter server command names
Diffstat (limited to 'server/tests/api/activitypub')
-rw-r--r-- | server/tests/api/activitypub/cleaner.ts | 52 | ||||
-rw-r--r-- | server/tests/api/activitypub/client.ts | 6 | ||||
-rw-r--r-- | server/tests/api/activitypub/fetch.ts | 18 | ||||
-rw-r--r-- | server/tests/api/activitypub/refresher.ts | 52 | ||||
-rw-r--r-- | server/tests/api/activitypub/security.ts | 8 |
5 files changed, 68 insertions, 68 deletions
diff --git a/server/tests/api/activitypub/cleaner.ts b/server/tests/api/activitypub/cleaner.ts index dcf758711..1421824da 100644 --- a/server/tests/api/activitypub/cleaner.ts +++ b/server/tests/api/activitypub/cleaner.ts | |||
@@ -46,9 +46,9 @@ describe('Test AP cleaner', function () { | |||
46 | // Create 1 comment per video | 46 | // Create 1 comment per video |
47 | // Update 1 remote URL and 1 local URL on | 47 | // Update 1 remote URL and 1 local URL on |
48 | 48 | ||
49 | videoUUID1 = (await servers[0].videosCommand.quickUpload({ name: 'server 1' })).uuid | 49 | videoUUID1 = (await servers[0].videos.quickUpload({ name: 'server 1' })).uuid |
50 | videoUUID2 = (await servers[1].videosCommand.quickUpload({ name: 'server 2' })).uuid | 50 | videoUUID2 = (await servers[1].videos.quickUpload({ name: 'server 2' })).uuid |
51 | videoUUID3 = (await servers[2].videosCommand.quickUpload({ name: 'server 3' })).uuid | 51 | videoUUID3 = (await servers[2].videos.quickUpload({ name: 'server 3' })).uuid |
52 | 52 | ||
53 | videoUUIDs = [ videoUUID1, videoUUID2, videoUUID3 ] | 53 | videoUUIDs = [ videoUUID1, videoUUID2, videoUUID3 ] |
54 | 54 | ||
@@ -56,8 +56,8 @@ describe('Test AP cleaner', function () { | |||
56 | 56 | ||
57 | for (const server of servers) { | 57 | for (const server of servers) { |
58 | for (const uuid of videoUUIDs) { | 58 | for (const uuid of videoUUIDs) { |
59 | await server.videosCommand.rate({ id: uuid, rating: 'like' }) | 59 | await server.videos.rate({ id: uuid, rating: 'like' }) |
60 | await server.commentsCommand.createThread({ videoId: uuid, text: 'comment' }) | 60 | await server.comments.createThread({ videoId: uuid, text: 'comment' }) |
61 | } | 61 | } |
62 | } | 62 | } |
63 | 63 | ||
@@ -67,7 +67,7 @@ describe('Test AP cleaner', function () { | |||
67 | it('Should have the correct likes', async function () { | 67 | it('Should have the correct likes', async function () { |
68 | for (const server of servers) { | 68 | for (const server of servers) { |
69 | for (const uuid of videoUUIDs) { | 69 | for (const uuid of videoUUIDs) { |
70 | const video = await server.videosCommand.get({ id: uuid }) | 70 | const video = await server.videos.get({ id: uuid }) |
71 | 71 | ||
72 | expect(video.likes).to.equal(3) | 72 | expect(video.likes).to.equal(3) |
73 | expect(video.dislikes).to.equal(0) | 73 | expect(video.dislikes).to.equal(0) |
@@ -78,9 +78,9 @@ describe('Test AP cleaner', function () { | |||
78 | it('Should destroy server 3 internal likes and correctly clean them', async function () { | 78 | it('Should destroy server 3 internal likes and correctly clean them', async function () { |
79 | this.timeout(20000) | 79 | this.timeout(20000) |
80 | 80 | ||
81 | await servers[2].sqlCommand.deleteAll('accountVideoRate') | 81 | await servers[2].sql.deleteAll('accountVideoRate') |
82 | for (const uuid of videoUUIDs) { | 82 | for (const uuid of videoUUIDs) { |
83 | await servers[2].sqlCommand.setVideoField(uuid, 'likes', '0') | 83 | await servers[2].sql.setVideoField(uuid, 'likes', '0') |
84 | } | 84 | } |
85 | 85 | ||
86 | await wait(5000) | 86 | await wait(5000) |
@@ -88,14 +88,14 @@ describe('Test AP cleaner', function () { | |||
88 | 88 | ||
89 | // Updated rates of my video | 89 | // Updated rates of my video |
90 | { | 90 | { |
91 | const video = await servers[0].videosCommand.get({ id: videoUUID1 }) | 91 | const video = await servers[0].videos.get({ id: videoUUID1 }) |
92 | expect(video.likes).to.equal(2) | 92 | expect(video.likes).to.equal(2) |
93 | expect(video.dislikes).to.equal(0) | 93 | expect(video.dislikes).to.equal(0) |
94 | } | 94 | } |
95 | 95 | ||
96 | // Did not update rates of a remote video | 96 | // Did not update rates of a remote video |
97 | { | 97 | { |
98 | const video = await servers[0].videosCommand.get({ id: videoUUID2 }) | 98 | const video = await servers[0].videos.get({ id: videoUUID2 }) |
99 | expect(video.likes).to.equal(3) | 99 | expect(video.likes).to.equal(3) |
100 | expect(video.dislikes).to.equal(0) | 100 | expect(video.dislikes).to.equal(0) |
101 | } | 101 | } |
@@ -106,7 +106,7 @@ describe('Test AP cleaner', function () { | |||
106 | 106 | ||
107 | for (const server of servers) { | 107 | for (const server of servers) { |
108 | for (const uuid of videoUUIDs) { | 108 | for (const uuid of videoUUIDs) { |
109 | await server.videosCommand.rate({ id: uuid, rating: 'dislike' }) | 109 | await server.videos.rate({ id: uuid, rating: 'dislike' }) |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
@@ -114,7 +114,7 @@ describe('Test AP cleaner', function () { | |||
114 | 114 | ||
115 | for (const server of servers) { | 115 | for (const server of servers) { |
116 | for (const uuid of videoUUIDs) { | 116 | for (const uuid of videoUUIDs) { |
117 | const video = await server.videosCommand.get({ id: uuid }) | 117 | const video = await server.videos.get({ id: uuid }) |
118 | expect(video.likes).to.equal(0) | 118 | expect(video.likes).to.equal(0) |
119 | expect(video.dislikes).to.equal(3) | 119 | expect(video.dislikes).to.equal(3) |
120 | } | 120 | } |
@@ -124,10 +124,10 @@ describe('Test AP cleaner', function () { | |||
124 | it('Should destroy server 3 internal dislikes and correctly clean them', async function () { | 124 | it('Should destroy server 3 internal dislikes and correctly clean them', async function () { |
125 | this.timeout(20000) | 125 | this.timeout(20000) |
126 | 126 | ||
127 | await servers[2].sqlCommand.deleteAll('accountVideoRate') | 127 | await servers[2].sql.deleteAll('accountVideoRate') |
128 | 128 | ||
129 | for (const uuid of videoUUIDs) { | 129 | for (const uuid of videoUUIDs) { |
130 | await servers[2].sqlCommand.setVideoField(uuid, 'dislikes', '0') | 130 | await servers[2].sql.setVideoField(uuid, 'dislikes', '0') |
131 | } | 131 | } |
132 | 132 | ||
133 | await wait(5000) | 133 | await wait(5000) |
@@ -135,14 +135,14 @@ describe('Test AP cleaner', function () { | |||
135 | 135 | ||
136 | // Updated rates of my video | 136 | // Updated rates of my video |
137 | { | 137 | { |
138 | const video = await servers[0].videosCommand.get({ id: videoUUID1 }) | 138 | const video = await servers[0].videos.get({ id: videoUUID1 }) |
139 | expect(video.likes).to.equal(0) | 139 | expect(video.likes).to.equal(0) |
140 | expect(video.dislikes).to.equal(2) | 140 | expect(video.dislikes).to.equal(2) |
141 | } | 141 | } |
142 | 142 | ||
143 | // Did not update rates of a remote video | 143 | // Did not update rates of a remote video |
144 | { | 144 | { |
145 | const video = await servers[0].videosCommand.get({ id: videoUUID2 }) | 145 | const video = await servers[0].videos.get({ id: videoUUID2 }) |
146 | expect(video.likes).to.equal(0) | 146 | expect(video.likes).to.equal(0) |
147 | expect(video.dislikes).to.equal(3) | 147 | expect(video.dislikes).to.equal(3) |
148 | } | 148 | } |
@@ -151,15 +151,15 @@ describe('Test AP cleaner', function () { | |||
151 | it('Should destroy server 3 internal shares and correctly clean them', async function () { | 151 | it('Should destroy server 3 internal shares and correctly clean them', async function () { |
152 | this.timeout(20000) | 152 | this.timeout(20000) |
153 | 153 | ||
154 | const preCount = await servers[0].sqlCommand.getCount('videoShare') | 154 | const preCount = await servers[0].sql.getCount('videoShare') |
155 | expect(preCount).to.equal(6) | 155 | expect(preCount).to.equal(6) |
156 | 156 | ||
157 | await servers[2].sqlCommand.deleteAll('videoShare') | 157 | await servers[2].sql.deleteAll('videoShare') |
158 | await wait(5000) | 158 | await wait(5000) |
159 | await waitJobs(servers) | 159 | await waitJobs(servers) |
160 | 160 | ||
161 | // Still 6 because we don't have remote shares on local videos | 161 | // Still 6 because we don't have remote shares on local videos |
162 | const postCount = await servers[0].sqlCommand.getCount('videoShare') | 162 | const postCount = await servers[0].sql.getCount('videoShare') |
163 | expect(postCount).to.equal(6) | 163 | expect(postCount).to.equal(6) |
164 | }) | 164 | }) |
165 | 165 | ||
@@ -167,17 +167,17 @@ describe('Test AP cleaner', function () { | |||
167 | this.timeout(20000) | 167 | this.timeout(20000) |
168 | 168 | ||
169 | { | 169 | { |
170 | const { total } = await servers[0].commentsCommand.listThreads({ videoId: videoUUID1 }) | 170 | const { total } = await servers[0].comments.listThreads({ videoId: videoUUID1 }) |
171 | expect(total).to.equal(3) | 171 | expect(total).to.equal(3) |
172 | } | 172 | } |
173 | 173 | ||
174 | await servers[2].sqlCommand.deleteAll('videoComment') | 174 | await servers[2].sql.deleteAll('videoComment') |
175 | 175 | ||
176 | await wait(5000) | 176 | await wait(5000) |
177 | await waitJobs(servers) | 177 | await waitJobs(servers) |
178 | 178 | ||
179 | { | 179 | { |
180 | const { total } = await servers[0].commentsCommand.listThreads({ videoId: videoUUID1 }) | 180 | const { total } = await servers[0].comments.listThreads({ videoId: videoUUID1 }) |
181 | expect(total).to.equal(2) | 181 | expect(total).to.equal(2) |
182 | } | 182 | } |
183 | }) | 183 | }) |
@@ -188,7 +188,7 @@ describe('Test AP cleaner', function () { | |||
188 | async function check (like: string, ofServerUrl: string, urlSuffix: string, remote: 'true' | 'false') { | 188 | async function check (like: string, ofServerUrl: string, urlSuffix: string, remote: 'true' | 'false') { |
189 | const query = `SELECT "videoId", "accountVideoRate".url FROM "accountVideoRate" ` + | 189 | const query = `SELECT "videoId", "accountVideoRate".url FROM "accountVideoRate" ` + |
190 | `INNER JOIN video ON "accountVideoRate"."videoId" = video.id AND remote IS ${remote} WHERE "accountVideoRate"."url" LIKE '${like}'` | 190 | `INNER JOIN video ON "accountVideoRate"."videoId" = video.id AND remote IS ${remote} WHERE "accountVideoRate"."url" LIKE '${like}'` |
191 | const res = await servers[0].sqlCommand.selectQuery(query) | 191 | const res = await servers[0].sql.selectQuery(query) |
192 | 192 | ||
193 | for (const rate of res) { | 193 | for (const rate of res) { |
194 | const matcher = new RegExp(`^${ofServerUrl}/accounts/root/dislikes/\\d+${urlSuffix}$`) | 194 | const matcher = new RegExp(`^${ofServerUrl}/accounts/root/dislikes/\\d+${urlSuffix}$`) |
@@ -217,7 +217,7 @@ describe('Test AP cleaner', function () { | |||
217 | 217 | ||
218 | { | 218 | { |
219 | const query = `UPDATE "accountVideoRate" SET url = url || 'stan'` | 219 | const query = `UPDATE "accountVideoRate" SET url = url || 'stan'` |
220 | await servers[1].sqlCommand.updateQuery(query) | 220 | await servers[1].sql.updateQuery(query) |
221 | 221 | ||
222 | await wait(5000) | 222 | await wait(5000) |
223 | await waitJobs(servers) | 223 | await waitJobs(servers) |
@@ -234,7 +234,7 @@ describe('Test AP cleaner', function () { | |||
234 | const query = `SELECT "videoId", "videoComment".url, uuid as "videoUUID" FROM "videoComment" ` + | 234 | const query = `SELECT "videoId", "videoComment".url, uuid as "videoUUID" FROM "videoComment" ` + |
235 | `INNER JOIN video ON "videoComment"."videoId" = video.id AND remote IS ${remote} WHERE "videoComment"."url" LIKE '${like}'` | 235 | `INNER JOIN video ON "videoComment"."videoId" = video.id AND remote IS ${remote} WHERE "videoComment"."url" LIKE '${like}'` |
236 | 236 | ||
237 | const res = await servers[0].sqlCommand.selectQuery(query) | 237 | const res = await servers[0].sql.selectQuery(query) |
238 | 238 | ||
239 | for (const comment of res) { | 239 | for (const comment of res) { |
240 | const matcher = new RegExp(`${ofServerUrl}/videos/watch/${comment.videoUUID}/comments/\\d+${urlSuffix}`) | 240 | const matcher = new RegExp(`${ofServerUrl}/videos/watch/${comment.videoUUID}/comments/\\d+${urlSuffix}`) |
@@ -260,7 +260,7 @@ describe('Test AP cleaner', function () { | |||
260 | 260 | ||
261 | { | 261 | { |
262 | const query = `UPDATE "videoComment" SET url = url || 'kyle'` | 262 | const query = `UPDATE "videoComment" SET url = url || 'kyle'` |
263 | await servers[1].sqlCommand.updateQuery(query) | 263 | await servers[1].sql.updateQuery(query) |
264 | 264 | ||
265 | await wait(5000) | 265 | await wait(5000) |
266 | await waitJobs(servers) | 266 | await waitJobs(servers) |
diff --git a/server/tests/api/activitypub/client.ts b/server/tests/api/activitypub/client.ts index 0190df04c..5845045a3 100644 --- a/server/tests/api/activitypub/client.ts +++ b/server/tests/api/activitypub/client.ts | |||
@@ -68,12 +68,12 @@ describe('Test activitypub', function () { | |||
68 | await setDefaultVideoChannel(servers) | 68 | await setDefaultVideoChannel(servers) |
69 | 69 | ||
70 | { | 70 | { |
71 | video = await await servers[0].videosCommand.quickUpload({ name: 'video' }) | 71 | video = await await servers[0].videos.quickUpload({ name: 'video' }) |
72 | } | 72 | } |
73 | 73 | ||
74 | { | 74 | { |
75 | const attributes = { displayName: 'playlist', privacy: VideoPlaylistPrivacy.PUBLIC, videoChannelId: servers[0].videoChannel.id } | 75 | const attributes = { displayName: 'playlist', privacy: VideoPlaylistPrivacy.PUBLIC, videoChannelId: servers[0].store.channel.id } |
76 | playlist = await servers[0].playlistsCommand.create({ attributes }) | 76 | playlist = await servers[0].playlists.create({ attributes }) |
77 | } | 77 | } |
78 | 78 | ||
79 | await doubleFollow(servers[0], servers[1]) | 79 | await doubleFollow(servers[0], servers[1]) |
diff --git a/server/tests/api/activitypub/fetch.ts b/server/tests/api/activitypub/fetch.ts index 5ab4a85d7..34694a773 100644 --- a/server/tests/api/activitypub/fetch.ts +++ b/server/tests/api/activitypub/fetch.ts | |||
@@ -21,24 +21,24 @@ describe('Test ActivityPub fetcher', function () { | |||
21 | 21 | ||
22 | const user = { username: 'user1', password: 'password' } | 22 | const user = { username: 'user1', password: 'password' } |
23 | for (const server of servers) { | 23 | for (const server of servers) { |
24 | await server.usersCommand.create({ username: user.username, password: user.password }) | 24 | await server.users.create({ username: user.username, password: user.password }) |
25 | } | 25 | } |
26 | 26 | ||
27 | const userAccessToken = await servers[0].loginCommand.getAccessToken(user) | 27 | const userAccessToken = await servers[0].login.getAccessToken(user) |
28 | 28 | ||
29 | await servers[0].videosCommand.upload({ attributes: { name: 'video root' } }) | 29 | await servers[0].videos.upload({ attributes: { name: 'video root' } }) |
30 | const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'bad video root' } }) | 30 | const { uuid } = await servers[0].videos.upload({ attributes: { name: 'bad video root' } }) |
31 | await servers[0].videosCommand.upload({ token: userAccessToken, attributes: { name: 'video user' } }) | 31 | await servers[0].videos.upload({ token: userAccessToken, attributes: { name: 'video user' } }) |
32 | 32 | ||
33 | { | 33 | { |
34 | const to = 'http://localhost:' + servers[0].port + '/accounts/user1' | 34 | const to = 'http://localhost:' + servers[0].port + '/accounts/user1' |
35 | const value = 'http://localhost:' + servers[1].port + '/accounts/user1' | 35 | const value = 'http://localhost:' + servers[1].port + '/accounts/user1' |
36 | await servers[0].sqlCommand.setActorField(to, 'url', value) | 36 | await servers[0].sql.setActorField(to, 'url', value) |
37 | } | 37 | } |
38 | 38 | ||
39 | { | 39 | { |
40 | const value = 'http://localhost:' + servers[2].port + '/videos/watch/' + uuid | 40 | const value = 'http://localhost:' + servers[2].port + '/videos/watch/' + uuid |
41 | await servers[0].sqlCommand.setVideoField(uuid, 'url', value) | 41 | await servers[0].sql.setVideoField(uuid, 'url', value) |
42 | } | 42 | } |
43 | }) | 43 | }) |
44 | 44 | ||
@@ -49,7 +49,7 @@ describe('Test ActivityPub fetcher', function () { | |||
49 | await waitJobs(servers) | 49 | await waitJobs(servers) |
50 | 50 | ||
51 | { | 51 | { |
52 | const { total, data } = await servers[0].videosCommand.list({ sort: 'createdAt' }) | 52 | const { total, data } = await servers[0].videos.list({ sort: 'createdAt' }) |
53 | 53 | ||
54 | expect(total).to.equal(3) | 54 | expect(total).to.equal(3) |
55 | expect(data[0].name).to.equal('video root') | 55 | expect(data[0].name).to.equal('video root') |
@@ -58,7 +58,7 @@ describe('Test ActivityPub fetcher', function () { | |||
58 | } | 58 | } |
59 | 59 | ||
60 | { | 60 | { |
61 | const { total, data } = await servers[1].videosCommand.list({ sort: 'createdAt' }) | 61 | const { total, data } = await servers[1].videos.list({ sort: 'createdAt' }) |
62 | 62 | ||
63 | expect(total).to.equal(1) | 63 | expect(total).to.equal(1) |
64 | expect(data[0].name).to.equal('video root') | 64 | expect(data[0].name).to.equal('video root') |
diff --git a/server/tests/api/activitypub/refresher.ts b/server/tests/api/activitypub/refresher.ts index 5af4b1edb..d2f71e857 100644 --- a/server/tests/api/activitypub/refresher.ts +++ b/server/tests/api/activitypub/refresher.ts | |||
@@ -34,28 +34,28 @@ describe('Test AP refresher', function () { | |||
34 | await setDefaultVideoChannel(servers) | 34 | await setDefaultVideoChannel(servers) |
35 | 35 | ||
36 | { | 36 | { |
37 | videoUUID1 = (await servers[1].videosCommand.quickUpload({ name: 'video1' })).uuid | 37 | videoUUID1 = (await servers[1].videos.quickUpload({ name: 'video1' })).uuid |
38 | videoUUID2 = (await servers[1].videosCommand.quickUpload({ name: 'video2' })).uuid | 38 | videoUUID2 = (await servers[1].videos.quickUpload({ name: 'video2' })).uuid |
39 | videoUUID3 = (await servers[1].videosCommand.quickUpload({ name: 'video3' })).uuid | 39 | videoUUID3 = (await servers[1].videos.quickUpload({ name: 'video3' })).uuid |
40 | } | 40 | } |
41 | 41 | ||
42 | { | 42 | { |
43 | const token1 = await servers[1].usersCommand.generateUserAndToken('user1') | 43 | const token1 = await servers[1].users.generateUserAndToken('user1') |
44 | await servers[1].videosCommand.upload({ token: token1, attributes: { name: 'video4' } }) | 44 | await servers[1].videos.upload({ token: token1, attributes: { name: 'video4' } }) |
45 | 45 | ||
46 | const token2 = await servers[1].usersCommand.generateUserAndToken('user2') | 46 | const token2 = await servers[1].users.generateUserAndToken('user2') |
47 | await servers[1].videosCommand.upload({ token: token2, attributes: { name: 'video5' } }) | 47 | await servers[1].videos.upload({ token: token2, attributes: { name: 'video5' } }) |
48 | } | 48 | } |
49 | 49 | ||
50 | { | 50 | { |
51 | const attributes = { displayName: 'playlist1', privacy: VideoPlaylistPrivacy.PUBLIC, videoChannelId: servers[1].videoChannel.id } | 51 | const attributes = { displayName: 'playlist1', privacy: VideoPlaylistPrivacy.PUBLIC, videoChannelId: servers[1].store.channel.id } |
52 | const created = await servers[1].playlistsCommand.create({ attributes }) | 52 | const created = await servers[1].playlists.create({ attributes }) |
53 | playlistUUID1 = created.uuid | 53 | playlistUUID1 = created.uuid |
54 | } | 54 | } |
55 | 55 | ||
56 | { | 56 | { |
57 | const attributes = { displayName: 'playlist2', privacy: VideoPlaylistPrivacy.PUBLIC, videoChannelId: servers[1].videoChannel.id } | 57 | const attributes = { displayName: 'playlist2', privacy: VideoPlaylistPrivacy.PUBLIC, videoChannelId: servers[1].store.channel.id } |
58 | const created = await servers[1].playlistsCommand.create({ attributes }) | 58 | const created = await servers[1].playlists.create({ attributes }) |
59 | playlistUUID2 = created.uuid | 59 | playlistUUID2 = created.uuid |
60 | } | 60 | } |
61 | 61 | ||
@@ -70,15 +70,15 @@ describe('Test AP refresher', function () { | |||
70 | await wait(10000) | 70 | await wait(10000) |
71 | 71 | ||
72 | // Change UUID so the remote server returns a 404 | 72 | // Change UUID so the remote server returns a 404 |
73 | await servers[1].sqlCommand.setVideoField(videoUUID1, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b174f') | 73 | await servers[1].sql.setVideoField(videoUUID1, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b174f') |
74 | 74 | ||
75 | await servers[0].videosCommand.get({ id: videoUUID1 }) | 75 | await servers[0].videos.get({ id: videoUUID1 }) |
76 | await servers[0].videosCommand.get({ id: videoUUID2 }) | 76 | await servers[0].videos.get({ id: videoUUID2 }) |
77 | 77 | ||
78 | await waitJobs(servers) | 78 | await waitJobs(servers) |
79 | 79 | ||
80 | await servers[0].videosCommand.get({ id: videoUUID1, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | 80 | await servers[0].videos.get({ id: videoUUID1, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
81 | await servers[0].videosCommand.get({ id: videoUUID2 }) | 81 | await servers[0].videos.get({ id: videoUUID2 }) |
82 | }) | 82 | }) |
83 | 83 | ||
84 | it('Should not update a remote video if the remote instance is down', async function () { | 84 | it('Should not update a remote video if the remote instance is down', async function () { |
@@ -86,18 +86,18 @@ describe('Test AP refresher', function () { | |||
86 | 86 | ||
87 | await killallServers([ servers[1] ]) | 87 | await killallServers([ servers[1] ]) |
88 | 88 | ||
89 | await servers[1].sqlCommand.setVideoField(videoUUID3, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b174e') | 89 | await servers[1].sql.setVideoField(videoUUID3, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b174e') |
90 | 90 | ||
91 | // Video will need a refresh | 91 | // Video will need a refresh |
92 | await wait(10000) | 92 | await wait(10000) |
93 | 93 | ||
94 | await servers[0].videosCommand.get({ id: videoUUID3 }) | 94 | await servers[0].videos.get({ id: videoUUID3 }) |
95 | // The refresh should fail | 95 | // The refresh should fail |
96 | await waitJobs([ servers[0] ]) | 96 | await waitJobs([ servers[0] ]) |
97 | 97 | ||
98 | await reRunServer(servers[1]) | 98 | await reRunServer(servers[1]) |
99 | 99 | ||
100 | await servers[0].videosCommand.get({ id: videoUUID3 }) | 100 | await servers[0].videos.get({ id: videoUUID3 }) |
101 | }) | 101 | }) |
102 | }) | 102 | }) |
103 | 103 | ||
@@ -106,13 +106,13 @@ describe('Test AP refresher', function () { | |||
106 | it('Should remove a deleted actor', async function () { | 106 | it('Should remove a deleted actor', async function () { |
107 | this.timeout(60000) | 107 | this.timeout(60000) |
108 | 108 | ||
109 | const command = servers[0].accountsCommand | 109 | const command = servers[0].accounts |
110 | 110 | ||
111 | await wait(10000) | 111 | await wait(10000) |
112 | 112 | ||
113 | // Change actor name so the remote server returns a 404 | 113 | // Change actor name so the remote server returns a 404 |
114 | const to = 'http://localhost:' + servers[1].port + '/accounts/user2' | 114 | const to = 'http://localhost:' + servers[1].port + '/accounts/user2' |
115 | await servers[1].sqlCommand.setActorField(to, 'preferredUsername', 'toto') | 115 | await servers[1].sql.setActorField(to, 'preferredUsername', 'toto') |
116 | 116 | ||
117 | await command.get({ accountName: 'user1@localhost:' + servers[1].port }) | 117 | await command.get({ accountName: 'user1@localhost:' + servers[1].port }) |
118 | await command.get({ accountName: 'user2@localhost:' + servers[1].port }) | 118 | await command.get({ accountName: 'user2@localhost:' + servers[1].port }) |
@@ -132,15 +132,15 @@ describe('Test AP refresher', function () { | |||
132 | await wait(10000) | 132 | await wait(10000) |
133 | 133 | ||
134 | // Change UUID so the remote server returns a 404 | 134 | // Change UUID so the remote server returns a 404 |
135 | await servers[1].sqlCommand.setPlaylistField(playlistUUID2, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b178e') | 135 | await servers[1].sql.setPlaylistField(playlistUUID2, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b178e') |
136 | 136 | ||
137 | await servers[0].playlistsCommand.get({ playlistId: playlistUUID1 }) | 137 | await servers[0].playlists.get({ playlistId: playlistUUID1 }) |
138 | await servers[0].playlistsCommand.get({ playlistId: playlistUUID2 }) | 138 | await servers[0].playlists.get({ playlistId: playlistUUID2 }) |
139 | 139 | ||
140 | await waitJobs(servers) | 140 | await waitJobs(servers) |
141 | 141 | ||
142 | await servers[0].playlistsCommand.get({ playlistId: playlistUUID1, expectedStatus: HttpStatusCode.OK_200 }) | 142 | await servers[0].playlists.get({ playlistId: playlistUUID1, expectedStatus: HttpStatusCode.OK_200 }) |
143 | await servers[0].playlistsCommand.get({ playlistId: playlistUUID2, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | 143 | await servers[0].playlists.get({ playlistId: playlistUUID2, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
144 | }) | 144 | }) |
145 | }) | 145 | }) |
146 | 146 | ||
diff --git a/server/tests/api/activitypub/security.ts b/server/tests/api/activitypub/security.ts index c32940070..ab0eb256e 100644 --- a/server/tests/api/activitypub/security.ts +++ b/server/tests/api/activitypub/security.ts | |||
@@ -24,8 +24,8 @@ function setKeysOfServer (onServer: ServerInfo, ofServer: ServerInfo, publicKey: | |||
24 | const url = 'http://localhost:' + ofServer.port + '/accounts/peertube' | 24 | const url = 'http://localhost:' + ofServer.port + '/accounts/peertube' |
25 | 25 | ||
26 | return Promise.all([ | 26 | return Promise.all([ |
27 | onServer.sqlCommand.setActorField(url, 'publicKey', publicKey), | 27 | onServer.sql.setActorField(url, 'publicKey', publicKey), |
28 | onServer.sqlCommand.setActorField(url, 'privateKey', privateKey) | 28 | onServer.sql.setActorField(url, 'privateKey', privateKey) |
29 | ]) | 29 | ]) |
30 | } | 30 | } |
31 | 31 | ||
@@ -33,8 +33,8 @@ function setUpdatedAtOfServer (onServer: ServerInfo, ofServer: ServerInfo, updat | |||
33 | const url = 'http://localhost:' + ofServer.port + '/accounts/peertube' | 33 | const url = 'http://localhost:' + ofServer.port + '/accounts/peertube' |
34 | 34 | ||
35 | return Promise.all([ | 35 | return Promise.all([ |
36 | onServer.sqlCommand.setActorField(url, 'createdAt', updatedAt), | 36 | onServer.sql.setActorField(url, 'createdAt', updatedAt), |
37 | onServer.sqlCommand.setActorField(url, 'updatedAt', updatedAt) | 37 | onServer.sql.setActorField(url, 'updatedAt', updatedAt) |
38 | ]) | 38 | ]) |
39 | } | 39 | } |
40 | 40 | ||