mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
feature(cloudcmd) spero, ishtar, salam, remedy, omnes -> fileop
This commit is contained in:
parent
cccffc57ba
commit
bc25f1babb
5 changed files with 213 additions and 257 deletions
|
|
@ -13,6 +13,7 @@ const {
|
|||
_authenticate,
|
||||
_getPrefix,
|
||||
_authCheck,
|
||||
_authCheckNew,
|
||||
_replacePrefix,
|
||||
_replaceDist,
|
||||
} = cloudcmd;
|
||||
|
|
@ -118,7 +119,62 @@ test('cloudcmd: replaceDist: !isDev', (t) => {
|
|||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: authCheck: success', (t) => {
|
||||
test('cloudcmd: authCheckNew: reject', (t) => {
|
||||
const auth = config('auth');
|
||||
const accept = sinon.stub();
|
||||
const reject = sinon.stub();
|
||||
const username = 'root';
|
||||
const password = 'toor';
|
||||
|
||||
const set = credentials();
|
||||
const reset = set('hello', 'world');
|
||||
config('auth', true);
|
||||
|
||||
_authCheckNew(accept, reject, username, password);
|
||||
|
||||
config('auth', auth);
|
||||
reset();
|
||||
|
||||
t.ok(reject.called, 'should accept');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: authCheckNew: accept', (t) => {
|
||||
const auth = config('auth');
|
||||
const accept = sinon.stub();
|
||||
const reject = sinon.stub();
|
||||
const username = 'root';
|
||||
const password = 'toor';
|
||||
|
||||
const set = credentials();
|
||||
const reset = set(username, password);
|
||||
config('auth', true);
|
||||
|
||||
_authCheckNew(accept, reject, username, password);
|
||||
|
||||
config('auth', auth);
|
||||
reset();
|
||||
|
||||
t.ok(accept.called, 'should accept');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: authCheckNew: accept: no auth', (t) => {
|
||||
const auth = config('auth');
|
||||
const accept = sinon.stub();
|
||||
const reject = sinon.stub();
|
||||
const username = 'root';
|
||||
const password = 'toor';
|
||||
|
||||
config('auth', false);
|
||||
_authCheckNew(accept, reject, username, password);
|
||||
config('auth', auth);
|
||||
|
||||
t.ok(accept.called, 'should accept');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: authCheckNew: reject', (t) => {
|
||||
const auth = config('auth');
|
||||
const success = sinon.stub();
|
||||
const on = sinon.stub;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue