* removes from emailverificationtoken spec * updates winston * Updates ValidationAndPasswordsReset * Use local request in schemas * Removes request in rest.spec * Removes request from PushRouter0 * removes request from public API * removes request from index.spec * Removes request form parse.push spec * removes request from ParseInstallation spec * Removes from ParseHooks * removes request from ParseGlobalConfig.spec * Removes request from ParseAPI.spec.js * removes request from LogsRouter * removes in features * Filters undefined headers instead of crashing * Removes request from ParseUser spec * Removes usage of request in ParseFile.spec.js * Removes request from AuthAdapters.js * removes request-promise from ParseGeoPoint.spec * Removes request-promise from ParseQuery spec * remove request-promise from UserPII * removes request-promise from EnableExpressErrorHandler * Updates RevocableSessionUpgrade spec * Update RestQuery * Removes read preferenceOptionM * ensure we forward auth from URL * use request in CloudCode.spec.js * Removes request-promise from JobSchedule.spec * Removes rp from VerifyUserPassword.spec.js * Removes rp from PasswordPolicy spec * Removes rp from ParsePolygon spec * Removes rp from fullTextSearch spec * Removes rp from PArseQuery.Aggregate * Ensure we properly forward errors * Removes request and request-promise
146 lines
3.6 KiB
JavaScript
146 lines
3.6 KiB
JavaScript
const req = require('../lib/request');
|
|
|
|
const request = function(url, callback) {
|
|
return req({
|
|
url,
|
|
}).then(response => callback(null, response), err => callback(err, err));
|
|
};
|
|
|
|
describe('public API', () => {
|
|
it('should get invalid_link.html', done => {
|
|
request(
|
|
'http://localhost:8378/1/apps/invalid_link.html',
|
|
(err, httpResponse) => {
|
|
expect(httpResponse.status).toBe(200);
|
|
done();
|
|
}
|
|
);
|
|
});
|
|
|
|
it('should get choose_password', done => {
|
|
reconfigureServer({
|
|
appName: 'unused',
|
|
publicServerURL: 'http://localhost:8378/1',
|
|
}).then(() => {
|
|
request(
|
|
'http://localhost:8378/1/apps/choose_password?id=test',
|
|
(err, httpResponse) => {
|
|
expect(httpResponse.status).toBe(200);
|
|
done();
|
|
}
|
|
);
|
|
});
|
|
});
|
|
|
|
it('should get verify_email_success.html', done => {
|
|
request(
|
|
'http://localhost:8378/1/apps/verify_email_success.html',
|
|
(err, httpResponse) => {
|
|
expect(httpResponse.status).toBe(200);
|
|
done();
|
|
}
|
|
);
|
|
});
|
|
|
|
it('should get password_reset_success.html', done => {
|
|
request(
|
|
'http://localhost:8378/1/apps/password_reset_success.html',
|
|
(err, httpResponse) => {
|
|
expect(httpResponse.status).toBe(200);
|
|
done();
|
|
}
|
|
);
|
|
});
|
|
});
|
|
|
|
describe('public API without publicServerURL', () => {
|
|
beforeEach(done => {
|
|
reconfigureServer({ appName: 'unused' }).then(done, fail);
|
|
});
|
|
it('should get 404 on verify_email', done => {
|
|
request(
|
|
'http://localhost:8378/1/apps/test/verify_email',
|
|
(err, httpResponse) => {
|
|
expect(httpResponse.status).toBe(404);
|
|
done();
|
|
}
|
|
);
|
|
});
|
|
|
|
it('should get 404 choose_password', done => {
|
|
request(
|
|
'http://localhost:8378/1/apps/choose_password?id=test',
|
|
(err, httpResponse) => {
|
|
expect(httpResponse.status).toBe(404);
|
|
done();
|
|
}
|
|
);
|
|
});
|
|
|
|
it('should get 404 on request_password_reset', done => {
|
|
request(
|
|
'http://localhost:8378/1/apps/test/request_password_reset',
|
|
(err, httpResponse) => {
|
|
expect(httpResponse.status).toBe(404);
|
|
done();
|
|
}
|
|
);
|
|
});
|
|
});
|
|
|
|
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.status).toBe(403);
|
|
done();
|
|
}
|
|
);
|
|
});
|
|
|
|
it('should get 403 choose_password', done => {
|
|
request(
|
|
'http://localhost:8378/1/apps/choose_password?id=invalid',
|
|
(err, httpResponse) => {
|
|
expect(httpResponse.status).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.status).toBe(403);
|
|
done();
|
|
}
|
|
);
|
|
});
|
|
|
|
it('should get 403 on post of request_password_reset', done => {
|
|
req({
|
|
url: 'http://localhost:8378/1/apps/invalid/request_password_reset',
|
|
method: 'POST',
|
|
}).then(done.fail, httpResponse => {
|
|
expect(httpResponse.status).toBe(403);
|
|
done();
|
|
});
|
|
});
|
|
|
|
it('should get 403 on resendVerificationEmail', done => {
|
|
request(
|
|
'http://localhost:8378/1/apps/invalid/resend_verification_email',
|
|
(err, httpResponse) => {
|
|
expect(httpResponse.status).toBe(403);
|
|
done();
|
|
}
|
|
);
|
|
});
|
|
});
|