@@ -20,4 +20,102 @@ describe("#plugin", function() {
2020 } ) ;
2121 } ) ;
2222
23+ describe ( "#install" , function ( ) {
24+
25+ it ( "should get plugin privileges" , function ( done ) {
26+ this . timeout ( 15000 ) ;
27+ var plugin = docker . getPlugin ( 'sshfs' , 'vieux/sshfs' ) ;
28+
29+ function handler ( err , data ) {
30+ expect ( err ) . to . be . null ;
31+ expect ( data ) . to . be . a ( 'array' ) ;
32+ console . log ( data ) ;
33+ done ( ) ;
34+ }
35+
36+ plugin . privileges ( handler ) ;
37+ } ) ;
38+
39+ it ( "should pull a plugin" , function ( done ) {
40+ this . timeout ( 60000 ) ;
41+
42+ var plugin = docker . getPlugin ( 'sshfs' ) ;
43+
44+ //geezzz url, querystring and body...
45+ plugin . install ( {
46+ '_query' : {
47+ 'remote' : 'vieux/sshfs'
48+ } ,
49+ '_body' : [ {
50+ 'Name' : 'network' ,
51+ 'Description' : '' ,
52+ 'Value' : [
53+ 'host'
54+ ]
55+ } , {
56+ 'Name' : 'capabilities' ,
57+ 'Description' : '' ,
58+ 'Value' : [
59+ 'CAP_SYS_ADMIN'
60+ ]
61+ } , {
62+ 'Name' : 'mount' ,
63+ 'Description' : '' ,
64+ 'Value' : [
65+ '/var/lib/docker/plugins/'
66+ ]
67+ } , {
68+ 'Name' : 'device' ,
69+ 'Description' : '' ,
70+ 'Value' : [
71+ '/dev/fuse'
72+ ]
73+ } ]
74+ } , function ( err , stream ) {
75+ if ( err ) return done ( err ) ;
76+ stream . pipe ( process . stdout ) ;
77+ stream . once ( 'end' , done ) ;
78+ } ) ;
79+
80+ } ) ;
81+
82+ it ( "should enable a plugin" , function ( done ) {
83+ this . timeout ( 15000 ) ;
84+ var plugin = docker . getPlugin ( 'sshfs' ) ;
85+
86+ function handler ( err , data ) {
87+ expect ( err ) . to . be . null ;
88+ expect ( data ) . to . be . ok ;
89+ done ( ) ;
90+ }
91+
92+ plugin . enable ( handler ) ;
93+ } ) ;
94+
95+ it ( "should disable a plugin" , function ( done ) {
96+ this . timeout ( 15000 ) ;
97+ var plugin = docker . getPlugin ( 'sshfs' ) ;
98+
99+ function handler ( err , data ) {
100+ expect ( err ) . to . be . null ;
101+ expect ( data ) . to . be . ok ;
102+ done ( ) ;
103+ }
104+
105+ plugin . disable ( handler ) ;
106+ } ) ;
107+
108+ it ( "should remove a plugin" , function ( done ) {
109+ this . timeout ( 15000 ) ;
110+ var plugin = docker . getPlugin ( 'sshfs' ) ;
111+
112+ function handler ( err , data ) {
113+ expect ( err ) . to . be . null ;
114+ expect ( data ) . to . be . ok ;
115+ done ( ) ;
116+ }
117+
118+ plugin . remove ( handler ) ;
119+ } ) ;
120+ } ) ;
23121} ) ;
0 commit comments