Let auth data be updated on login (#2219)

* Let user update authData token upon login

* Adds tests that ensures linked authData isnt overriden

* fixes focused testing problem
This commit is contained in:
Florent Vilmart
2016-07-09 00:49:46 -04:00
committed by Drew
parent 4e9e817a80
commit 61aa5a8d62
3 changed files with 122 additions and 11 deletions

View File

@@ -281,17 +281,17 @@ function range(n) {
return answer;
}
function mockFacebook() {
function mockFacebookAuthenticator(id, token) {
var facebook = {};
facebook.validateAuthData = function(authData) {
if (authData.id === '8675309' && authData.access_token === 'jenny') {
if (authData.id === id && authData.access_token.startsWith(token)) {
return Promise.resolve();
} else {
throw undefined;
}
};
facebook.validateAppId = function(appId, authData) {
if (authData.access_token === 'jenny') {
if (authData.access_token.startsWith(token)) {
return Promise.resolve();
} else {
throw undefined;
@@ -300,6 +300,10 @@ function mockFacebook() {
return facebook;
}
function mockFacebook() {
return mockFacebookAuthenticator('8675309', 'jenny');
}
// This is polluting, but, it makes it way easier to directly port old tests.
@@ -320,6 +324,7 @@ global.jequal = jequal;
global.range = range;
global.reconfigureServer = reconfigureServer;
global.defaultConfiguration = defaultConfiguration;
global.mockFacebookAuthenticator = mockFacebookAuthenticator;
global.it_exclude_dbs = excluded => {
if (excluded.includes(process.env.PARSE_SERVER_TEST_DB)) {