]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/videos/services.ts
Change video abuse API response
[github/Chocobozzz/PeerTube.git] / server / tests / api / videos / services.ts
index b3167aebc70215082e0808f64042e3182f0ea686..45b4a1a8112404ca1e289c29f3547ed5c1be267f 100644 (file)
@@ -1,25 +1,17 @@
 /* tslint:disable:no-unused-expression */
 
-import 'mocha'
 import * as chai from 'chai'
-const expect = chai.expect
-
-import {
-  ServerInfo,
-  flushTests,
-  uploadVideo,
-  getVideosList,
-  setAccessTokensToServers,
-  killallServers,
-  getOEmbed
-} from '../../utils/index'
+import 'mocha'
+import { flushTests, getOEmbed, getVideosList, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../utils/index'
 import { runServer } from '../../utils/server/servers'
 
+const expect = chai.expect
+
 describe('Test services', function () {
   let server: ServerInfo = null
 
   before(async function () {
-    this.timeout(10000)
+    this.timeout(30000)
 
     await flushTests()
 
@@ -30,8 +22,10 @@ describe('Test services', function () {
     const videoAttributes = {
       name: 'my super name'
     }
-    const res = await uploadVideo(server.url, server.accessToken, videoAttributes)
-    server.video = res.body.video
+    await uploadVideo(server.url, server.accessToken, videoAttributes)
+
+    const res = await getVideosList(server.url)
+    server.video = res.body.data[0]
   })
 
   it('Should have a valid oEmbed response', async function () {
@@ -44,7 +38,7 @@ describe('Test services', function () {
 
     expect(res.body.html).to.equal(expectedHtml)
     expect(res.body.title).to.equal(server.video.name)
-    expect(res.body.author_name).to.equal(server.video.accountName)
+    expect(res.body.author_name).to.equal(server.video.account.name)
     expect(res.body.width).to.equal(560)
     expect(res.body.height).to.equal(315)
     expect(res.body.thumbnail_url).to.equal(expectedThumbnailUrl)
@@ -64,7 +58,7 @@ describe('Test services', function () {
 
     expect(res.body.html).to.equal(expectedHtml)
     expect(res.body.title).to.equal(server.video.name)
-    expect(res.body.author_name).to.equal(server.video.accountName)
+    expect(res.body.author_name).to.equal(server.video.account.name)
     expect(res.body.height).to.equal(50)
     expect(res.body.width).to.equal(50)
     expect(res.body).to.not.have.property('thumbnail_url')