@@ -24,17 +24,88 @@ var util = require('util');
2424var config = require ( '../my_config.json' ) ;
2525
2626
27- describe ( 'AwsCli' , function ( ) {
28-
29- it ( 'should merge opts' , function ( ) {
30- var awsCli = new AwsCli ( { a : 'a' } ) ;
31- assert . isNotNull ( awsCli ) ;
32- assert . equal ( awsCli . a , 'a' ) ;
33- //console.log('awsCli', awsCli);
34- } ) ;
35-
36-
37- it ( 'command iam list-users should pass' , function ( done ) {
27+ //describe('AwsCli run without modifications', function () {
28+
29+ // it('should merge opts', function () {
30+ // var awsCli = new AwsCli({ a: 'a' });
31+ // assert.isNotNull(awsCli);
32+ // assert.equal(awsCli.a, 'a');
33+ // //console.log('awsCli', awsCli);
34+ // });
35+
36+
37+ // it('command iam list-users should pass', function (done) {
38+ // this.timeout(1 * 60 * 1000);//1 minute
39+
40+ // var awsCli = new AwsCli({
41+ // aws_access_key_id: config.aws.accessKeyId,
42+ // aws_secret_access_key: config.aws.secretAccessKey
43+ // //cwd: 'path to current working directory'
44+ // });
45+
46+ // assert.isNotNull(awsCli);
47+ // var failed = false;
48+ // var err = null;
49+ // awsCli.command('iam list-users').then(function (data) {
50+ // //console.log('data = ', util.inspect(data, {depth: 10}));
51+ // assert.isNotNull(data);
52+ // }).finally(function () {
53+ // //console.log('finally ');
54+ // assert.isFalse(failed);
55+ // assert.isNull(err);
56+ // done();
57+ // });
58+ // });
59+
60+ // it('command iam list-users should pass with callback', function (done) {
61+ // this.timeout(1 * 60 * 1000);//1 minute
62+
63+ // var awsCli = new AwsCli({
64+ // aws_access_key_id: config.aws.accessKeyId,
65+ // aws_secret_access_key: config.aws.secretAccessKey
66+ // //cwd: 'path to current working directory'
67+ // });
68+
69+ // assert.isNotNull(awsCli);
70+ // var failed = false;
71+ // var err = null;
72+ // awsCli.command('iam list-users', function (err, data) {
73+ // //console.log('data = ', util.inspect(data, { depth: 10 }));
74+ // assert.isNotNull(data);
75+ // done();
76+ // });
77+ // });
78+
79+ // it('command aim2 should fail', function (done) {
80+ // var awsCli = new AwsCli();
81+ // assert.isNotNull(awsCli);
82+ // var failed = false;
83+ // var err = null;
84+ // awsCli.command('iam2 list-users').then(function (data) {
85+ // //console.log('data = ', data);
86+ // assert.isNotNull(data);
87+ // }).catch(function (error) {
88+ // assert.isNotNull(error);
89+ // err = error;
90+ // failed = true;
91+ // //console.log('error = ', error);
92+ // }).finally(function () {
93+ // //console.log('finally ');
94+ // assert.isTrue(failed);
95+ // assert.isNotNull(err);
96+ // done();
97+ // });
98+ // });
99+
100+
101+ //});
102+
103+
104+
105+ describe ( 'AwsCli change ids' , function ( ) {
106+ var instance_id = 'i-789b3ba7' ;
107+
108+ it ( 'ec2 describe-instances' , function ( done ) {
38109 this . timeout ( 1 * 60 * 1000 ) ; //1 minute
39110
40111 var awsCli = new AwsCli ( {
@@ -46,7 +117,7 @@ describe('AwsCli', function () {
46117 assert . isNotNull ( awsCli ) ;
47118 var failed = false ;
48119 var err = null ;
49- awsCli . command ( 'iam list-users' ) . then ( function ( data ) {
120+ awsCli . command ( 'ec2 describe-instances --instance-ids ' + instance_id ) . then ( function ( data ) {
50121 //console.log('data = ', util.inspect(data, {depth: 10}));
51122 assert . isNotNull ( data ) ;
52123 } ) . finally ( function ( ) {
@@ -57,7 +128,7 @@ describe('AwsCli', function () {
57128 } ) ;
58129 } ) ;
59130
60- it ( 'command iam list-users should pass with callback ' , function ( done ) {
131+ it ( 'ec2 describe-instances with options ' , function ( done ) {
61132 this . timeout ( 1 * 60 * 1000 ) ; //1 minute
62133
63134 var awsCli = new AwsCli ( {
@@ -69,38 +140,15 @@ describe('AwsCli', function () {
69140 assert . isNotNull ( awsCli ) ;
70141 var failed = false ;
71142 var err = null ;
72- awsCli . command ( 'iam list-users ' , function ( err , data ) {
143+ awsCli . command ( 'ec2 describe-instances ' , { 'instance-ids' : instance_id } ) . then ( function ( data ) {
73144 //console.log('data = ', util.inspect(data, { depth: 10 }));
74145 assert . isNotNull ( data ) ;
75- done ( ) ;
76- } ) ;
77- } ) ;
78-
79- it ( 'command aim2 should fail' , function ( done ) {
80- var awsCli = new AwsCli ( ) ;
81- assert . isNotNull ( awsCli ) ;
82- var failed = false ;
83- var err = null ;
84- awsCli . command ( 'iam2 list-users' ) . then ( function ( data ) {
85- //console.log('data = ', data);
86- assert . isNotNull ( data ) ;
87- } ) . catch ( function ( error ) {
88- assert . isNotNull ( error ) ;
89- err = error ;
90- failed = true ;
91- //console.log('error = ', error);
92146 } ) . finally ( function ( ) {
93147 //console.log('finally ');
94- assert . isTrue ( failed ) ;
95- assert . isNotNull ( err ) ;
148+ assert . isFalse ( failed ) ;
149+ assert . isNull ( err ) ;
96150 done ( ) ;
97151 } ) ;
98152 } ) ;
99153
100154} ) ;
101-
102-
103-
104-
105-
106-
0 commit comments