Last active
August 29, 2015 14:16
-
-
Save muka/2ba7a854dac791080e4b to your computer and use it in GitHub Desktop.
idm test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// install deps | |
// npm i muka/Appcelerator@idm | |
// 1 get the captcha link, from cli | |
// # node test.js | |
// 2 visit the link displayed | |
// 3 create the user, from cli | |
// # node test.js [session] [captcha] | |
var idmTest = function() { | |
compose.config.debug = true; | |
var credentials = { | |
username: "test-" + (new Date).getTime(), | |
password: "pwd-"+Math.random((new Date).getTime()) + (new Date).getTime() | |
}; | |
if(process.argv[2] && process.argv[3]) { | |
console.log("Session %s", process.argv[2]); | |
console.log("Captcha %s", process.argv[3]); | |
compose.getIdm().getUserSession(process.argv[2], credentials).validate(process.argv[3]) | |
.then(function(res) { | |
console.log("Created!", res); | |
}) | |
.catch(function(err) { | |
console.log("Error!", err); | |
}) | |
; | |
} | |
else { | |
compose.getIdm().createUser().then(function(session) { | |
console.log(session); | |
}); | |
} | |
}; | |
idmTest(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment