-import { HttpStatusCode } from '@shared/core-utils'
-import {
- cleanupTests,
- flushAndRunServer,
- getMyUserInformation,
- getUsersList,
- PluginsCommand,
- ServerInfo,
- setAccessTokensToServers,
- updateMyUser,
- wait
-} from '@shared/extra-utils'
-import { User, UserRole } from '@shared/models'
+import { wait } from '@shared/core-utils'
+import { HttpStatusCode, UserRole } from '@shared/models'
+import { cleanupTests, createSingleServer, PeerTubeServer, PluginsCommand, setAccessTokensToServers } from '@shared/server-commands'
await setAccessTokensToServers([ server ])
for (const suffix of [ 'one', 'two', 'three' ]) {
await setAccessTokensToServers([ server ])
for (const suffix of [ 'one', 'two', 'three' ]) {
- 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 })
expect(body.username).to.equal('spyro')
expect(body.account.displayName).to.equal('Spyro the Dragon')
expect(body.username).to.equal('spyro')
expect(body.account.displayName).to.equal('Spyro the Dragon')
- const res = await getMyUserInformation(server.url, crashAccessToken)
- const user: User = res.body
- expect(user.username).to.equal('crash')
+ const body = await server.users.getMyInfo({ token: crashAccessToken })
+ expect(body.username).to.equal('crash')
displayName: 'Beautiful Crash',
description: 'Mutant eastern barred bandicoot'
})
displayName: 'Beautiful Crash',
description: 'Mutant eastern barred bandicoot'
})
expect(body.account.displayName).to.equal('Beautiful Crash')
expect(body.account.description).to.equal('Mutant eastern barred bandicoot')
})
it('Should logout Crash', async function () {
expect(body.account.displayName).to.equal('Beautiful Crash')
expect(body.account.description).to.equal('Mutant eastern barred bandicoot')
})
it('Should logout Crash', async function () {
expect(body.username).to.equal('crash')
expect(body.account.displayName).to.equal('Beautiful Crash')
expect(body.account.description).to.equal('Mutant eastern barred bandicoot')
expect(body.username).to.equal('crash')
expect(body.account.displayName).to.equal('Beautiful Crash')
expect(body.account.description).to.equal('Mutant eastern barred bandicoot')
})
it('Should reject an invalid username, email, role or display name', async function () {
})
it('Should reject an invalid username, email, role or display name', async function () {
await command.login({ user: { username: 'ward', password: 'ward password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
await command.login({ user: { username: 'ward', password: 'ward password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
await command.login({ user: { username: 'kiros', password: 'kiros password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
await command.login({ user: { username: 'kiros', password: 'kiros password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
await command.login({ user: { username: 'raine', password: 'raine password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
await command.login({ user: { username: 'raine', password: 'raine password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
await command.login({ user: { username: 'ellone', password: 'elonne password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
await command.login({ user: { username: 'ellone', password: 'elonne password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
npmName: 'peertube-plugin-test-id-pass-auth-one',
settings: { disableSpyro: true }
})
npmName: 'peertube-plugin-test-id-pass-auth-one',
settings: { disableSpyro: true }
})
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 () {
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 () {
user: { username: 'crash', password: 'crash password' },
expectedStatus: HttpStatusCode.BAD_REQUEST_400
})
})
it('Should display the correct configuration', async function () {
user: { username: 'crash', password: 'crash password' },
expectedStatus: HttpStatusCode.BAD_REQUEST_400
})
})
it('Should display the correct configuration', async function () {
- const root = users.find(u => u.username === 'root')
- const crash = users.find(u => u.username === 'crash')
- const laguna = users.find(u => u.username === 'laguna')
+ const root = data.find(u => u.username === 'root')
+ const crash = data.find(u => u.username === 'crash')
+ const laguna = data.find(u => u.username === 'laguna')
expect(root.pluginAuth).to.be.null
expect(crash.pluginAuth).to.equal('peertube-plugin-test-id-pass-auth-one')
expect(root.pluginAuth).to.be.null
expect(crash.pluginAuth).to.equal('peertube-plugin-test-id-pass-auth-one')