2016-02-27 10:51:12 -05:00
|
|
|
|
|
|
|
|
var request = require('request');
|
|
|
|
|
|
|
|
|
|
describe("public API", () => {
|
|
|
|
|
it("should get invalid_link.html", (done) => {
|
2016-11-24 15:47:41 -05:00
|
|
|
request('http://localhost:8378/1/apps/invalid_link.html', (err, httpResponse) => {
|
2016-02-27 10:51:12 -05:00
|
|
|
expect(httpResponse.statusCode).toBe(200);
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
});
|
2016-06-10 20:27:21 -07:00
|
|
|
|
2016-02-27 10:51:12 -05:00
|
|
|
it("should get choose_password", (done) => {
|
2016-06-10 20:27:21 -07:00
|
|
|
reconfigureServer({
|
|
|
|
|
appName: 'unused',
|
|
|
|
|
publicServerURL: 'http://localhost:8378/1',
|
|
|
|
|
})
|
2017-06-20 09:15:26 -07:00
|
|
|
.then(() => {
|
|
|
|
|
request('http://localhost:8378/1/apps/choose_password?id=test', (err, httpResponse) => {
|
|
|
|
|
expect(httpResponse.statusCode).toBe(200);
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
})
|
2016-02-27 10:51:12 -05:00
|
|
|
});
|
2016-06-10 20:27:21 -07:00
|
|
|
|
2016-02-27 10:51:12 -05:00
|
|
|
it("should get verify_email_success.html", (done) => {
|
2016-11-24 15:47:41 -05:00
|
|
|
request('http://localhost:8378/1/apps/verify_email_success.html', (err, httpResponse) => {
|
2016-02-27 10:51:12 -05:00
|
|
|
expect(httpResponse.statusCode).toBe(200);
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
});
|
2016-06-10 20:27:21 -07:00
|
|
|
|
2016-02-27 10:51:12 -05:00
|
|
|
it("should get password_reset_success.html", (done) => {
|
2016-11-24 15:47:41 -05:00
|
|
|
request('http://localhost:8378/1/apps/password_reset_success.html', (err, httpResponse) => {
|
2016-02-27 10:51:12 -05:00
|
|
|
expect(httpResponse.statusCode).toBe(200);
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
});
|
2016-02-29 20:51:13 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe("public API without publicServerURL", () => {
|
2016-11-24 15:47:41 -05:00
|
|
|
beforeEach(done => {
|
2016-06-10 20:27:21 -07:00
|
|
|
reconfigureServer({ appName: 'unused' })
|
2017-06-20 09:15:26 -07:00
|
|
|
.then(done, fail);
|
2016-11-02 20:33:59 -04:00
|
|
|
});
|
2016-02-29 20:51:13 -05:00
|
|
|
it("should get 404 on verify_email", (done) => {
|
2016-11-24 15:47:41 -05:00
|
|
|
request('http://localhost:8378/1/apps/test/verify_email', (err, httpResponse) => {
|
2016-02-29 20:51:13 -05:00
|
|
|
expect(httpResponse.statusCode).toBe(404);
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
});
|
2016-06-10 20:27:21 -07:00
|
|
|
|
2016-02-29 20:51:13 -05:00
|
|
|
it("should get 404 choose_password", (done) => {
|
2016-11-24 15:47:41 -05:00
|
|
|
request('http://localhost:8378/1/apps/choose_password?id=test', (err, httpResponse) => {
|
2016-02-29 20:51:13 -05:00
|
|
|
expect(httpResponse.statusCode).toBe(404);
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
});
|
2016-06-10 20:27:21 -07:00
|
|
|
|
2016-02-29 20:51:13 -05:00
|
|
|
it("should get 404 on request_password_reset", (done) => {
|
2016-11-24 15:47:41 -05:00
|
|
|
request('http://localhost:8378/1/apps/test/request_password_reset', (err, httpResponse) => {
|
2016-02-29 20:51:13 -05:00
|
|
|
expect(httpResponse.statusCode).toBe(404);
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
2017-11-11 22:42:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
describe("public API supplied with invalid application id", () => {
|
|
|
|
|
beforeEach(done => {
|
|
|
|
|
reconfigureServer({appName: "unused"})
|
|
|
|
|
.then(done, fail);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should get 403 on verify_email", (done) => {
|
|
|
|
|
request('http://localhost:8378/1/apps/invalid/verify_email', (err, httpResponse) => {
|
|
|
|
|
expect(httpResponse.statusCode).toBe(403);
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should get 403 choose_password", (done) => {
|
|
|
|
|
request('http://localhost:8378/1/apps/choose_password?id=invalid', (err, httpResponse) => {
|
|
|
|
|
expect(httpResponse.statusCode).toBe(403);
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should get 403 on get of request_password_reset", (done) => {
|
|
|
|
|
request('http://localhost:8378/1/apps/invalid/request_password_reset', (err, httpResponse) => {
|
|
|
|
|
expect(httpResponse.statusCode).toBe(403);
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it("should get 403 on post of request_password_reset", (done) => {
|
|
|
|
|
request.post('http://localhost:8378/1/apps/invalid/request_password_reset', (err, httpResponse) => {
|
|
|
|
|
expect(httpResponse.statusCode).toBe(403);
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("should get 403 on resendVerificationEmail", (done) => {
|
|
|
|
|
request('http://localhost:8378/1/apps/invalid/resend_verification_email', (err, httpResponse) => {
|
|
|
|
|
expect(httpResponse.statusCode).toBe(403);
|
|
|
|
|
done();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|