get owner id when setting alias

This commit is contained in:
Girish Ramakrishnan 2016-09-28 21:02:38 -07:00
parent a4bdeb9cde
commit 8216aee8c4
2 changed files with 8 additions and 4 deletions

View File

@ -160,7 +160,6 @@ Cloudron.prototype.waitForApp = function (appId, version) {
return res.body;
};
Cloudron.prototype.waitForBox = function () {
process.stdout.write('Waiting for box.');
var res;
@ -353,8 +352,13 @@ Cloudron.prototype.addUser = function (username, email) {
return res.body;
};
Cloudron.prototype.setAliases = function (owner, aliases) {
var res = request.put(this._origin + '/api/v1/users/' + owner.id + '/aliases')
Cloudron.prototype.setAliases = function (aliases) {
var res = request.get(this._origin + '/api/v1/profile').query({ access_token: this._credentials.accessToken }).end();
common.verifyResponse2xx(res, 'Could not get profile');
console.log('user id is ', res.body.id);
res = request.put(this._origin + '/api/v1/users/' + res.body.id + '/aliases')
.query({ access_token: this._credentials.accessToken })
.send({ aliases: aliases })
.end();

View File

@ -72,7 +72,7 @@ describe('Cloudron backup testing', function () {
// mail alias tests (do this here because alias takes sometime to propagate)
it('can set aliases', function () {
cloudron.setAliases(owner, ['admin', 'mail']);
cloudron.setAliases(['admin', 'mail']);
});
// mail tests as normal user