]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Merge branch 'next' into develop
authorChocobozzz <me@florianbigard.com>
Wed, 21 Jul 2021 13:51:30 +0000 (15:51 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 21 Jul 2021 13:51:30 +0000 (15:51 +0200)
1  2 
server/tests/plugins/video-constants.ts

index 7b1312f88fb6c845acf63412b159d5bc5747b6a0,f527a2b3019e78c09b7b9175cfd231be9b5ff80b..19cba6c2c85d34651c7823cc8a5cb42b64bd617a
@@@ -1,25 -1,9 +1,16 @@@
  /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
  
- import * as chai from 'chai'
  import 'mocha'
- import { cleanupTests, flushAndRunServer, ServerInfo } from '../../../shared/extra-utils/server/servers'
+ import * as chai from 'chai'
 -import { cleanupTests, createSingleServer, PeerTubeServer, PluginsCommand, setAccessTokensToServers } from '@shared/extra-utils'
 +import {
-   createVideoPlaylist,
-   getPluginTestPath,
-   getVideo,
-   getVideoCategories,
-   getVideoLanguages,
-   getVideoLicences,
-   getVideoPlaylistPrivacies,
-   getVideoPrivacies,
-   installPlugin,
++  cleanupTests,
++  createSingleServer,
 +  makeGetRequest,
-   setAccessTokensToServers,
-   uninstallPlugin,
-   uploadVideo
- } from '../../../shared/extra-utils'
- import { VideoDetails, VideoPlaylistPrivacy } from '../../../shared/models/videos'
- import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
++  PeerTubeServer,
++  PluginsCommand,
++  setAccessTokensToServers
++} from '@shared/extra-utils'
+ import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
  
  const expect = chai.expect
  
@@@ -176,38 -139,6 +146,37 @@@ describe('Test plugin altering video co
      }
    })
  
-     await installPlugin({
-       url: server.url,
-       accessToken: server.accessToken,
-       path: getPluginTestPath('-video-constants')
-     })
 +  it('Should be able to reset categories', async function () {
-     let { body: categories } = await getVideoCategories(server.url)
++    await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-video-constants') })
 +
-     expect(categories[1]).to.not.exist
-     expect(categories[2]).to.not.exist
++    {
++      const categories = await server.videos.getCategories()
 +
-     expect(categories[42]).to.exist
-     expect(categories[43]).to.exist
++      expect(categories[1]).to.not.exist
++      expect(categories[2]).to.not.exist
 +
-       statusCodeExpected: HttpStatusCode.NO_CONTENT_204
++      expect(categories[42]).to.exist
++      expect(categories[43]).to.exist
++    }
 +
 +    await makeGetRequest({
 +      url: server.url,
 +      token: server.accessToken,
 +      path: '/plugins/test-video-constants/router/reset-categories',
-     const { body } = await getVideoCategories(server.url)
-     categories = body
++      expectedStatus: HttpStatusCode.NO_CONTENT_204
 +    })
 +
-     expect(categories[1]).to.exist
-     expect(categories[2]).to.exist
++    {
++      const categories = await server.videos.getCategories()
 +
-     expect(categories[42]).to.not.exist
-     expect(categories[43]).to.not.exist
++      expect(categories[1]).to.exist
++      expect(categories[2]).to.exist
 +
++      expect(categories[42]).to.not.exist
++      expect(categories[43]).to.not.exist
++    }
 +  })
 +
    after(async function () {
      await cleanupTests([ server ])
    })