2015-09-01 10:31:00 +03:00
|
|
|
/*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2015, Joyent, Inc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Integration tests for `triton account`
|
|
|
|
*/
|
|
|
|
|
|
|
|
var h = require('./helpers');
|
|
|
|
var test = require('tape');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// --- Globals
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// --- Tests
|
|
|
|
|
|
|
|
test('triton account', function (tt) {
|
|
|
|
|
|
|
|
tt.test(' triton account -h', function (t) {
|
|
|
|
h.triton('account -h', function (err, stdout, stderr) {
|
|
|
|
if (h.ifErr(t, err))
|
|
|
|
return t.end();
|
2015-09-22 20:55:42 +03:00
|
|
|
t.ok(/Usage:\s+triton account/.test(stdout), 'account usage');
|
2015-09-01 10:31:00 +03:00
|
|
|
t.end();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
tt.test(' triton help account', function (t) {
|
|
|
|
h.triton('help account', function (err, stdout, stderr) {
|
|
|
|
if (h.ifErr(t, err))
|
|
|
|
return t.end();
|
2015-09-22 20:55:42 +03:00
|
|
|
t.ok(/Usage:\s+triton account/.test(stdout), 'account usage');
|
2015-09-01 10:31:00 +03:00
|
|
|
t.end();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-01-08 21:07:43 +02:00
|
|
|
tt.test(' triton account get', function (t) {
|
|
|
|
h.triton('account get', function (err, stdout, stderr) {
|
2015-09-01 10:31:00 +03:00
|
|
|
if (h.ifErr(t, err))
|
|
|
|
return t.end();
|
2015-10-07 09:09:52 +03:00
|
|
|
t.ok(new RegExp(
|
|
|
|
'^login: ' + h.CONFIG.profile.account, 'm').test(stdout));
|
2015-09-01 10:31:00 +03:00
|
|
|
t.end();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-01-08 21:07:43 +02:00
|
|
|
tt.test(' triton account get -j', function (t) {
|
|
|
|
h.triton('account get -j', function (err, stdout, stderr) {
|
2015-09-01 10:31:00 +03:00
|
|
|
if (h.ifErr(t, err))
|
|
|
|
return t.end();
|
|
|
|
var account = JSON.parse(stdout);
|
2015-10-07 09:09:52 +03:00
|
|
|
t.equal(account.login, h.CONFIG.profile.account, 'account.login');
|
2015-09-01 10:31:00 +03:00
|
|
|
t.end();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|