Browse Source

test(api): add tests for invite only signup

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4134/head
Pranav C 2 years ago
parent
commit
ecf9bee359
  1. 44
      packages/nocodb/tests/unit/rest/tests/org.test.ts

44
packages/nocodb/tests/unit/rest/tests/org.test.ts

@ -135,7 +135,7 @@ function authTests() {
}) })
it.only('Delete token', async () => { it('Delete token', async () => {
const r = await request(context.app) const r = await request(context.app)
.post('/api/v1/tokens') .post('/api/v1/tokens')
.set('xc-auth', context.token) .set('xc-auth', context.token)
@ -166,6 +166,48 @@ function authTests() {
}) })
it('Disable/Enable signup', async () => {
const args = {
email: 'dummyuser@example.com',
password: 'A1234abh2@dsad',
};
const failedRes = await request(context.app)
.post('/api/v1/auth/user/signup')
.send(args)
.expect(400)
expect(failedRes.body).to.be.an('object')
.to.have.property('msg')
.to.be.equal('Not allowed to signup, contact super admin.')
await request(context.app)
.post('/api/v1/app-settings')
.set('xc-auth', context.token)
.send({ enable_user_signup: true })
.expect(200)
const successRes = await request(context.app)
.post('/api/v1/auth/user/signup')
.send(args)
.expect(200)
expect(successRes.body).to.be.an('object')
.to.have.property('token')
.to.be.a('string')
const userMeRes = await request(context.app)
.get('/api/v1/auth/user/me')
.set('xc-auth', successRes.body.token)
.expect(200)
expect(userMeRes.body).to.be.an('object')
.to.have.property('email')
.to.be.eq(args.email)
})
} }
export default function() { export default function() {

Loading…
Cancel
Save