mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 10:49:28 +02:00
Shorter server command names
This commit is contained in:
parent
d23dd9fbfc
commit
89d241a79c
155 changed files with 2508 additions and 2508 deletions
|
@ -22,12 +22,12 @@ describe('Test id and pass auth plugins', function () {
|
|||
await setAccessTokensToServers([ server ])
|
||||
|
||||
for (const suffix of [ 'one', 'two', 'three' ]) {
|
||||
await server.pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-id-pass-auth-' + suffix) })
|
||||
await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-id-pass-auth-' + suffix) })
|
||||
}
|
||||
})
|
||||
|
||||
it('Should display the correct configuration', async function () {
|
||||
const config = await server.configCommand.getConfig()
|
||||
const config = await server.config.getConfig()
|
||||
|
||||
const auths = config.plugin.registeredIdAndPassAuths
|
||||
expect(auths).to.have.lengthOf(8)
|
||||
|
@ -39,13 +39,13 @@ describe('Test id and pass auth plugins', function () {
|
|||
})
|
||||
|
||||
it('Should not login', async function () {
|
||||
await server.loginCommand.login({ user: { username: 'toto', password: 'password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
await server.login.login({ user: { username: 'toto', password: 'password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
})
|
||||
|
||||
it('Should login Spyro, create the user and use the token', async function () {
|
||||
const accessToken = await server.loginCommand.getAccessToken({ username: 'spyro', password: 'spyro password' })
|
||||
const accessToken = await server.login.getAccessToken({ username: 'spyro', password: 'spyro password' })
|
||||
|
||||
const body = await server.usersCommand.getMyInfo({ token: accessToken })
|
||||
const body = await server.users.getMyInfo({ token: accessToken })
|
||||
|
||||
expect(body.username).to.equal('spyro')
|
||||
expect(body.account.displayName).to.equal('Spyro the Dragon')
|
||||
|
@ -54,13 +54,13 @@ describe('Test id and pass auth plugins', function () {
|
|||
|
||||
it('Should login Crash, create the user and use the token', async function () {
|
||||
{
|
||||
const body = await server.loginCommand.login({ user: { username: 'crash', password: 'crash password' } })
|
||||
const body = await server.login.login({ user: { username: 'crash', password: 'crash password' } })
|
||||
crashAccessToken = body.access_token
|
||||
crashRefreshToken = body.refresh_token
|
||||
}
|
||||
|
||||
{
|
||||
const body = await server.usersCommand.getMyInfo({ token: crashAccessToken })
|
||||
const body = await server.users.getMyInfo({ token: crashAccessToken })
|
||||
|
||||
expect(body.username).to.equal('crash')
|
||||
expect(body.account.displayName).to.equal('Crash Bandicoot')
|
||||
|
@ -70,13 +70,13 @@ describe('Test id and pass auth plugins', function () {
|
|||
|
||||
it('Should login the first Laguna, create the user and use the token', async function () {
|
||||
{
|
||||
const body = await server.loginCommand.login({ user: { username: 'laguna', password: 'laguna password' } })
|
||||
const body = await server.login.login({ user: { username: 'laguna', password: 'laguna password' } })
|
||||
lagunaAccessToken = body.access_token
|
||||
lagunaRefreshToken = body.refresh_token
|
||||
}
|
||||
|
||||
{
|
||||
const body = await server.usersCommand.getMyInfo({ token: lagunaAccessToken })
|
||||
const body = await server.users.getMyInfo({ token: lagunaAccessToken })
|
||||
|
||||
expect(body.username).to.equal('laguna')
|
||||
expect(body.account.displayName).to.equal('laguna')
|
||||
|
@ -86,46 +86,46 @@ describe('Test id and pass auth plugins', function () {
|
|||
|
||||
it('Should refresh crash token, but not laguna token', async function () {
|
||||
{
|
||||
const resRefresh = await server.loginCommand.refreshToken({ refreshToken: crashRefreshToken })
|
||||
const resRefresh = await server.login.refreshToken({ refreshToken: crashRefreshToken })
|
||||
crashAccessToken = resRefresh.body.access_token
|
||||
crashRefreshToken = resRefresh.body.refresh_token
|
||||
|
||||
const body = await server.usersCommand.getMyInfo({ token: crashAccessToken })
|
||||
const body = await server.users.getMyInfo({ token: crashAccessToken })
|
||||
expect(body.username).to.equal('crash')
|
||||
}
|
||||
|
||||
{
|
||||
await server.loginCommand.refreshToken({ refreshToken: lagunaRefreshToken, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
await server.login.refreshToken({ refreshToken: lagunaRefreshToken, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
}
|
||||
})
|
||||
|
||||
it('Should update Crash profile', async function () {
|
||||
await server.usersCommand.updateMe({
|
||||
await server.users.updateMe({
|
||||
token: crashAccessToken,
|
||||
displayName: 'Beautiful Crash',
|
||||
description: 'Mutant eastern barred bandicoot'
|
||||
})
|
||||
|
||||
const body = await server.usersCommand.getMyInfo({ token: crashAccessToken })
|
||||
const body = await server.users.getMyInfo({ token: crashAccessToken })
|
||||
|
||||
expect(body.account.displayName).to.equal('Beautiful Crash')
|
||||
expect(body.account.description).to.equal('Mutant eastern barred bandicoot')
|
||||
})
|
||||
|
||||
it('Should logout Crash', async function () {
|
||||
await server.loginCommand.logout({ token: crashAccessToken })
|
||||
await server.login.logout({ token: crashAccessToken })
|
||||
})
|
||||
|
||||
it('Should have logged out Crash', async function () {
|
||||
await server.serversCommand.waitUntilLog('On logout for auth 1 - 2')
|
||||
await server.servers.waitUntilLog('On logout for auth 1 - 2')
|
||||
|
||||
await server.usersCommand.getMyInfo({ token: crashAccessToken, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
|
||||
await server.users.getMyInfo({ token: crashAccessToken, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
|
||||
})
|
||||
|
||||
it('Should login Crash and keep the old existing profile', async function () {
|
||||
crashAccessToken = await server.loginCommand.getAccessToken({ username: 'crash', password: 'crash password' })
|
||||
crashAccessToken = await server.login.getAccessToken({ username: 'crash', password: 'crash password' })
|
||||
|
||||
const body = await server.usersCommand.getMyInfo({ token: crashAccessToken })
|
||||
const body = await server.users.getMyInfo({ token: crashAccessToken })
|
||||
|
||||
expect(body.username).to.equal('crash')
|
||||
expect(body.account.displayName).to.equal('Beautiful Crash')
|
||||
|
@ -138,38 +138,38 @@ describe('Test id and pass auth plugins', function () {
|
|||
|
||||
await wait(5000)
|
||||
|
||||
await server.usersCommand.getMyInfo({ token: lagunaAccessToken, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
|
||||
await server.users.getMyInfo({ token: lagunaAccessToken, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
|
||||
})
|
||||
|
||||
it('Should reject an invalid username, email, role or display name', async function () {
|
||||
const command = server.loginCommand
|
||||
const command = server.login
|
||||
|
||||
await command.login({ user: { username: 'ward', password: 'ward password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
await server.serversCommand.waitUntilLog('valid username')
|
||||
await server.servers.waitUntilLog('valid username')
|
||||
|
||||
await command.login({ user: { username: 'kiros', password: 'kiros password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
await server.serversCommand.waitUntilLog('valid display name')
|
||||
await server.servers.waitUntilLog('valid display name')
|
||||
|
||||
await command.login({ user: { username: 'raine', password: 'raine password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
await server.serversCommand.waitUntilLog('valid role')
|
||||
await server.servers.waitUntilLog('valid role')
|
||||
|
||||
await command.login({ user: { username: 'ellone', password: 'elonne password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
await server.serversCommand.waitUntilLog('valid email')
|
||||
await server.servers.waitUntilLog('valid email')
|
||||
})
|
||||
|
||||
it('Should unregister spyro-auth and do not login existing Spyro', async function () {
|
||||
await server.pluginsCommand.updateSettings({
|
||||
await server.plugins.updateSettings({
|
||||
npmName: 'peertube-plugin-test-id-pass-auth-one',
|
||||
settings: { disableSpyro: true }
|
||||
})
|
||||
|
||||
const command = server.loginCommand
|
||||
const command = server.login
|
||||
await command.login({ user: { username: 'spyro', password: 'spyro password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
await command.login({ user: { username: 'spyro', password: 'fake' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
})
|
||||
|
||||
it('Should have disabled this auth', async function () {
|
||||
const config = await server.configCommand.getConfig()
|
||||
const config = await server.config.getConfig()
|
||||
|
||||
const auths = config.plugin.registeredIdAndPassAuths
|
||||
expect(auths).to.have.lengthOf(7)
|
||||
|
@ -179,16 +179,16 @@ describe('Test id and pass auth plugins', function () {
|
|||
})
|
||||
|
||||
it('Should uninstall the plugin one and do not login existing Crash', async function () {
|
||||
await server.pluginsCommand.uninstall({ npmName: 'peertube-plugin-test-id-pass-auth-one' })
|
||||
await server.plugins.uninstall({ npmName: 'peertube-plugin-test-id-pass-auth-one' })
|
||||
|
||||
await server.loginCommand.login({
|
||||
await server.login.login({
|
||||
user: { username: 'crash', password: 'crash password' },
|
||||
expectedStatus: HttpStatusCode.BAD_REQUEST_400
|
||||
})
|
||||
})
|
||||
|
||||
it('Should display the correct configuration', async function () {
|
||||
const config = await server.configCommand.getConfig()
|
||||
const config = await server.config.getConfig()
|
||||
|
||||
const auths = config.plugin.registeredIdAndPassAuths
|
||||
expect(auths).to.have.lengthOf(6)
|
||||
|
@ -198,7 +198,7 @@ describe('Test id and pass auth plugins', function () {
|
|||
})
|
||||
|
||||
it('Should display plugin auth information in users list', async function () {
|
||||
const { data } = await server.usersCommand.list()
|
||||
const { data } = await server.users.list()
|
||||
|
||||
const root = data.find(u => u.username === 'root')
|
||||
const crash = data.find(u => u.username === 'crash')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue