import 'mocha'
import * as chai from 'chai'
-import { About } from '../../../../shared/models/server/about.model'
-import { CustomConfig } from '../../../../shared/models/server/custom-config.model'
+import { HttpStatusCode } from '@shared/core-utils'
import {
cleanupTests,
- deleteCustomConfig,
flushAndRunServer,
- getAbout,
- getConfig,
- getCustomConfig,
killallServers,
makeGetRequest,
parallelTests,
reRunServer,
ServerInfo,
setAccessTokensToServers,
- updateCustomConfig,
uploadVideo
-} from '../../../../shared/extra-utils'
-import { ServerConfig } from '../../../../shared/models'
-import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
+} from '@shared/extra-utils'
+import { CustomConfig } from '@shared/models'
const expect = chai.expect
}
describe('Test config', function () {
- let server = null
+ let server: ServerInfo = null
before(async function () {
this.timeout(30000)
})
it('Should have a correct config on a server with registration enabled', async function () {
- const res = await getConfig(server.url)
- const data: ServerConfig = res.body
+ const data = await server.configCommand.getConfig()
expect(data.signup.allowed).to.be.true
})
registerUser(server.url, 'user3', 'super password')
])
- const res = await getConfig(server.url)
- const data: ServerConfig = res.body
+ const data = await server.configCommand.getConfig()
expect(data.signup.allowed).to.be.false
})
it('Should have the correct video allowed extensions', async function () {
- const res = await getConfig(server.url)
- const data: ServerConfig = res.body
+ const data = await server.configCommand.getConfig()
expect(data.video.file.extensions).to.have.lengthOf(3)
expect(data.video.file.extensions).to.contain('.mp4')
})
it('Should get the customized configuration', async function () {
- const res = await getCustomConfig(server.url, server.accessToken)
- const data = res.body as CustomConfig
+ const data = await server.configCommand.getCustomConfig()
checkInitialConfig(server, data)
})
}
}
}
- await updateCustomConfig(server.url, server.accessToken, newCustomConfig)
-
- const res = await getCustomConfig(server.url, server.accessToken)
- const data = res.body
+ await server.configCommand.updateCustomConfig({ newCustomConfig })
+ const data = await server.configCommand.getCustomConfig()
checkUpdatedConfig(data)
})
it('Should have the correct updated video allowed extensions', async function () {
this.timeout(10000)
- const res = await getConfig(server.url)
- const data: ServerConfig = res.body
+ const data = await server.configCommand.getConfig()
expect(data.video.file.extensions).to.have.length.above(4)
expect(data.video.file.extensions).to.contain('.mp4')
await reRunServer(server)
- const res = await getCustomConfig(server.url, server.accessToken)
- const data = res.body
+ const data = await server.configCommand.getCustomConfig()
checkUpdatedConfig(data)
})
it('Should fetch the about information', async function () {
- const res = await getAbout(server.url)
- const data: About = res.body
+ const data = await server.configCommand.getAbout()
expect(data.instance.name).to.equal('PeerTube updated')
expect(data.instance.shortDescription).to.equal('my short description')
it('Should remove the custom configuration', async function () {
this.timeout(10000)
- await deleteCustomConfig(server.url, server.accessToken)
-
- const res = await getCustomConfig(server.url, server.accessToken)
- const data = res.body
+ await server.configCommand.deleteCustomConfig()
+ const data = await server.configCommand.getCustomConfig()
checkInitialConfig(server, data)
})