move various login routes under auth/
This commit is contained in:
@@ -70,7 +70,7 @@ describe('Cloudron API', function () {
|
||||
.ok(() => true);
|
||||
expect(response2.statusCode).to.equal(200);
|
||||
|
||||
const response3 = await superagent.post(`${serverUrl}/api/v1/cloudron/setup_account`)
|
||||
const response3 = await superagent.post(`${serverUrl}/api/v1/auth/setup_account`)
|
||||
.send({
|
||||
inviteToken: require('url').parse(response2.body.inviteLink, true).query.inviteToken,
|
||||
password: USER.password,
|
||||
@@ -89,7 +89,7 @@ describe('Cloudron API', function () {
|
||||
expect(response4.body.username).to.equal(USER.username);
|
||||
expect(response4.body.displayName).to.equal(USER.displayName);
|
||||
|
||||
const response5 = await superagent.post(`${serverUrl}/api/v1/cloudron/login`)
|
||||
const response5 = await superagent.post(`${serverUrl}/api/v1/auth/login`)
|
||||
.send({ username: USER.username, password: USER.password });
|
||||
expect(response5.statusCode).to.equal(200);
|
||||
});
|
||||
@@ -113,7 +113,7 @@ describe('Cloudron API', function () {
|
||||
.ok(() => true);
|
||||
expect(response2.statusCode).to.equal(200);
|
||||
|
||||
const response3 = await superagent.post(`${serverUrl}/api/v1/cloudron/setup_account`)
|
||||
const response3 = await superagent.post(`${serverUrl}/api/v1/auth/setup_account`)
|
||||
.send({
|
||||
inviteToken: require('url').parse(response2.body.inviteLink, true).query.inviteToken,
|
||||
password: USER.password,
|
||||
@@ -123,7 +123,7 @@ describe('Cloudron API', function () {
|
||||
.ok(() => true);
|
||||
expect(response3.statusCode).to.equal(409);
|
||||
|
||||
const response4 = await superagent.post(`${serverUrl}/api/v1/cloudron/setup_account`)
|
||||
const response4 = await superagent.post(`${serverUrl}/api/v1/auth/setup_account`)
|
||||
.send({
|
||||
inviteToken: require('url').parse(response2.body.inviteLink, true).query.inviteToken,
|
||||
password: USER.password,
|
||||
@@ -141,7 +141,7 @@ describe('Cloudron API', function () {
|
||||
expect(response5.body.username).to.equal(USER.username);
|
||||
expect(response5.body.displayName).to.equal(USER.displayName);
|
||||
|
||||
const response6 = await superagent.post(`${serverUrl}/api/v1/cloudron/login`)
|
||||
const response6 = await superagent.post(`${serverUrl}/api/v1/auth/login`)
|
||||
.send({ username: USER.username, password: USER.password });
|
||||
expect(response6.statusCode).to.equal(200);
|
||||
});
|
||||
@@ -170,7 +170,7 @@ describe('Cloudron API', function () {
|
||||
.ok(() => true);
|
||||
expect(response2.statusCode).to.equal(200);
|
||||
|
||||
const response3 = await superagent.post(`${serverUrl}/api/v1/cloudron/setup_account`)
|
||||
const response3 = await superagent.post(`${serverUrl}/api/v1/auth/setup_account`)
|
||||
.send({
|
||||
inviteToken: require('url').parse(response2.body.inviteLink, true).query.inviteToken,
|
||||
password: USER.password,
|
||||
@@ -189,7 +189,7 @@ describe('Cloudron API', function () {
|
||||
expect(response4.body.username).to.equal('presetup3'); // what the admin provided
|
||||
expect(response4.body.displayName).to.equal('pre setup3'); // what the admin provided
|
||||
|
||||
const response5 = await superagent.post(`${serverUrl}/api/v1/cloudron/login`)
|
||||
const response5 = await superagent.post(`${serverUrl}/api/v1/auth/login`)
|
||||
.send({ username: 'presetup3', password: USER.password });
|
||||
expect(response5.statusCode).to.equal(200);
|
||||
});
|
||||
@@ -197,13 +197,13 @@ describe('Cloudron API', function () {
|
||||
|
||||
describe('login', function () {
|
||||
it('cannot login without body', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/cloudron/login`)
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/auth/login`)
|
||||
.ok(() => true);
|
||||
expect(response.statusCode).to.equal(400);
|
||||
});
|
||||
|
||||
it('cannot login without username', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/cloudron/login`)
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/auth/login`)
|
||||
.send({ password: owner.password })
|
||||
.ok(() => true);
|
||||
|
||||
@@ -211,7 +211,7 @@ describe('Cloudron API', function () {
|
||||
});
|
||||
|
||||
it('cannot login without password', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/cloudron/login`)
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/auth/login`)
|
||||
.send({ username: owner.username })
|
||||
.ok(() => true);
|
||||
|
||||
@@ -219,7 +219,7 @@ describe('Cloudron API', function () {
|
||||
});
|
||||
|
||||
it('cannot login with empty username', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/cloudron/login`)
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/auth/login`)
|
||||
.send({ username: '', password: owner.password })
|
||||
.ok(() => true);
|
||||
|
||||
@@ -227,7 +227,7 @@ describe('Cloudron API', function () {
|
||||
});
|
||||
|
||||
it('cannot login with empty password', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/cloudron/login`)
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/auth/login`)
|
||||
.send({ username: owner.username, password: '' })
|
||||
.ok(() => true);
|
||||
|
||||
@@ -235,7 +235,7 @@ describe('Cloudron API', function () {
|
||||
});
|
||||
|
||||
it('cannot login with unknown username', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/cloudron/login`)
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/auth/login`)
|
||||
.send({ username: 'somethingrandom', password: owner.password })
|
||||
.ok(() => true);
|
||||
|
||||
@@ -243,7 +243,7 @@ describe('Cloudron API', function () {
|
||||
});
|
||||
|
||||
it('cannot login with unknown email', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/cloudron/login`)
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/auth/login`)
|
||||
.send({ username: 'randomgemail', password: owner.password })
|
||||
.ok(() => true);
|
||||
|
||||
@@ -251,7 +251,7 @@ describe('Cloudron API', function () {
|
||||
});
|
||||
|
||||
it('cannot login with wrong password', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/cloudron/login`)
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/auth/login`)
|
||||
.send({ username: owner.username, password: owner.password.toUpperCase() })
|
||||
.ok(() => true);
|
||||
|
||||
@@ -259,7 +259,7 @@ describe('Cloudron API', function () {
|
||||
});
|
||||
|
||||
it('can login with username', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/cloudron/login`)
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/auth/login`)
|
||||
.send({ username: owner.username, password: owner.password });
|
||||
|
||||
expect(response.statusCode).to.equal(200);
|
||||
@@ -268,7 +268,7 @@ describe('Cloudron API', function () {
|
||||
});
|
||||
|
||||
it('can login with uppercase username', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/cloudron/login`)
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/auth/login`)
|
||||
.send({ username: owner.username.toUpperCase(), password: owner.password });
|
||||
|
||||
expect(response.statusCode).to.equal(200);
|
||||
@@ -277,7 +277,7 @@ describe('Cloudron API', function () {
|
||||
});
|
||||
|
||||
it('can login with email', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/cloudron/login`)
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/auth/login`)
|
||||
.send({ username: owner.email, password: owner.password });
|
||||
|
||||
expect(response.statusCode).to.equal(200);
|
||||
@@ -286,7 +286,7 @@ describe('Cloudron API', function () {
|
||||
});
|
||||
|
||||
it('can login with uppercase email', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/cloudron/login`)
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/auth/login`)
|
||||
.send({ username: owner.email.toUpperCase(), password: owner.password });
|
||||
|
||||
expect(response.statusCode).to.equal(200);
|
||||
|
||||
Reference in New Issue
Block a user