aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-14 17:38:41 +0100
committerChocobozzz <me@florianbigard.com>2017-12-19 10:53:16 +0100
commit50d6de9c286abcb34ff4234d56d9cbb803db7665 (patch)
treef1732b27edcd05c7877a8358b8312f1e38c287ed /server/tests
parentfadf619ad61a016c1c7fc53de5a8f398a4f77519 (diff)
downloadPeerTube-50d6de9c286abcb34ff4234d56d9cbb803db7665.tar.gz
PeerTube-50d6de9c286abcb34ff4234d56d9cbb803db7665.tar.zst
PeerTube-50d6de9c286abcb34ff4234d56d9cbb803db7665.zip
Begin moving video channel to actor
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/check-params/follows.ts18
-rw-r--r--server/tests/api/follows.ts5
-rw-r--r--server/tests/utils/follows.ts4
3 files changed, 4 insertions, 23 deletions
diff --git a/server/tests/api/check-params/follows.ts b/server/tests/api/check-params/follows.ts
index 0af1562f5..cdd2783df 100644
--- a/server/tests/api/check-params/follows.ts
+++ b/server/tests/api/check-params/follows.ts
@@ -184,25 +184,9 @@ describe('Test server follows API validators', function () {
184 .expect(403) 184 .expect(403)
185 }) 185 })
186 186
187 it('Should fail with an undefined id', async function () {
188 await request(server.url)
189 .delete(path + '/' + undefined)
190 .set('Authorization', 'Bearer ' + server.accessToken)
191 .set('Accept', 'application/json')
192 .expect(400)
193 })
194
195 it('Should fail with an invalid id', async function () {
196 await request(server.url)
197 .delete(path + '/foobar')
198 .set('Authorization', 'Bearer ' + server.accessToken)
199 .set('Accept', 'application/json')
200 .expect(400)
201 })
202
203 it('Should fail we do not follow this server', async function () { 187 it('Should fail we do not follow this server', async function () {
204 await request(server.url) 188 await request(server.url)
205 .delete(path + '/-1') 189 .delete(path + '/example.com')
206 .set('Authorization', 'Bearer ' + server.accessToken) 190 .set('Authorization', 'Bearer ' + server.accessToken)
207 .set('Accept', 'application/json') 191 .set('Accept', 'application/json')
208 .expect(404) 192 .expect(404)
diff --git a/server/tests/api/follows.ts b/server/tests/api/follows.ts
index dcb4c8bd9..10eb48969 100644
--- a/server/tests/api/follows.ts
+++ b/server/tests/api/follows.ts
@@ -23,7 +23,6 @@ const expect = chai.expect
23 23
24describe('Test follows', function () { 24describe('Test follows', function () {
25 let servers: ServerInfo[] = [] 25 let servers: ServerInfo[] = []
26 let server3Id: number
27 26
28 before(async function () { 27 before(async function () {
29 this.timeout(20000) 28 this.timeout(20000)
@@ -82,8 +81,6 @@ describe('Test follows', function () {
82 expect(server3Follow).to.not.be.undefined 81 expect(server3Follow).to.not.be.undefined
83 expect(server2Follow.state).to.equal('accepted') 82 expect(server2Follow.state).to.equal('accepted')
84 expect(server3Follow.state).to.equal('accepted') 83 expect(server3Follow.state).to.equal('accepted')
85
86 server3Id = server3Follow.following.id
87 }) 84 })
88 85
89 it('Should have 0 followings on server 1 and 2', async function () { 86 it('Should have 0 followings on server 1 and 2', async function () {
@@ -121,7 +118,7 @@ describe('Test follows', function () {
121 it('Should unfollow server 3 on server 1', async function () { 118 it('Should unfollow server 3 on server 1', async function () {
122 this.timeout(5000) 119 this.timeout(5000)
123 120
124 await unfollow(servers[0].url, servers[0].accessToken, server3Id) 121 await unfollow(servers[0].url, servers[0].accessToken, servers[2])
125 122
126 await wait(3000) 123 await wait(3000)
127 }) 124 })
diff --git a/server/tests/utils/follows.ts b/server/tests/utils/follows.ts
index 033c6a719..a9f798bcb 100644
--- a/server/tests/utils/follows.ts
+++ b/server/tests/utils/follows.ts
@@ -42,8 +42,8 @@ async function follow (follower: string, following: string[], accessToken: strin
42 return res 42 return res
43} 43}
44 44
45async function unfollow (url: string, accessToken: string, id: number, expectedStatus = 204) { 45async function unfollow (url: string, accessToken: string, target: ServerInfo, expectedStatus = 204) {
46 const path = '/api/v1/server/following/' + id 46 const path = '/api/v1/server/following/' + target.host
47 47
48 const res = await request(url) 48 const res = await request(url)
49 .delete(path) 49 .delete(path)