Skip to content

Instantly share code, notes, and snippets.

@muka
Last active Aug 29, 2015
Embed
What would you like to do?
idm test
// 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