@@ -77,6 +77,40 @@ describe('Acceptance: ng github-pages:deploy', function() {
77
77
return ng ( [ 'github-pages:deploy' , '--skip-build' ] ) ;
78
78
} ) ;
79
79
80
+ it ( 'should deploy with token and username' , function ( ) {
81
+ let token = 'token' ,
82
+ username = 'bar' ;
83
+
84
+ execStub . addExecSuccess ( 'git status --porcelain' )
85
+ . addExecSuccess ( 'git rev-parse --abbrev-ref HEAD' , initialBranch )
86
+ . addExecSuccess ( 'git remote -v' , remote )
87
+ . addExecSuccess ( `git checkout ${ ghPagesBranch } ` )
88
+ . addExecSuccess ( 'git add .' )
89
+ . addExecSuccess ( `git commit -m "${ message } "` )
90
+ . addExecSuccess ( `git checkout ${ initialBranch } ` )
91
+ . addExecSuccess ( `git push https://${ token } @github.com/${ username } /${ project } .git ${ ghPagesBranch } :${ ghPagesBranch } ` )
92
+ . addExecSuccess ( 'git remote -v' , remote ) ;
93
+
94
+ return ng ( [ 'github-pages:deploy' , '--skip-build' , `--gh-token=${ token } ` , `--gh-username=${ username } ` ] ) ;
95
+ } )
96
+
97
+ it ( 'should deploy with token only' , function ( ) {
98
+ let token = 'token' ;
99
+
100
+ execStub . addExecSuccess ( 'git status --porcelain' )
101
+ . addExecSuccess ( 'git rev-parse --abbrev-ref HEAD' , initialBranch )
102
+ . addExecSuccess ( 'git remote -v' , remote )
103
+ . addExecSuccess ( `git checkout ${ ghPagesBranch } ` )
104
+ . addExecSuccess ( 'git add .' )
105
+ . addExecSuccess ( `git commit -m "${ message } "` )
106
+ . addExecSuccess ( `git checkout ${ initialBranch } ` )
107
+ . addExecSuccess ( 'git remote -v' , remote )
108
+ . addExecSuccess ( `git push https://${ token } @github.com/username/${ project } .git ${ ghPagesBranch } :${ ghPagesBranch } ` )
109
+ . addExecSuccess ( 'git remote -v' , remote ) ;
110
+
111
+ return ng ( [ 'github-pages:deploy' , '--skip-build' , `--gh-token=${ token } ` ] ) ;
112
+ } ) ;
113
+
80
114
it ( 'should deploy with changed defaults' , function ( ) {
81
115
let userPageBranch = 'master' ,
82
116
message = 'not new gh-pages version' ;
@@ -126,14 +160,14 @@ describe('Acceptance: ng github-pages:deploy', function() {
126
160
. addExecSuccess ( 'git rev-parse --abbrev-ref HEAD' , initialBranch )
127
161
. addExecSuccess ( 'git remote -v' , noRemote )
128
162
. addExecSuccess ( `git remote add origin [email protected] :${ username } /${ project } .git` )
129
- . addExecSuccess ( `git push -u origin ${ initialBranch } ` )
163
+ . addExecSuccess ( `git push -u https:// ${ token } @github.com/ ${ username } / ${ project } .git ${ initialBranch } ` )
130
164
. addExecSuccess ( `git checkout ${ ghPagesBranch } ` )
131
165
. addExecSuccess ( 'git ls-files' )
132
166
. addExecSuccess ( 'git rm -r ' )
133
167
. addExecSuccess ( 'git add .' )
134
168
. addExecSuccess ( `git commit -m "${ message } "` )
135
169
. addExecSuccess ( `git checkout ${ initialBranch } ` )
136
- . addExecSuccess ( `git push origin ${ ghPagesBranch } :${ ghPagesBranch } ` )
170
+ . addExecSuccess ( `git push https:// ${ token } @github.com/ ${ username } / ${ project } .git ${ ghPagesBranch } :${ ghPagesBranch } ` )
137
171
. addExecSuccess ( 'git remote -v' , remote ) ;
138
172
139
173
var httpsStub = sinon . stub ( https , 'request' , httpsRequestStubFunc ) ;
0 commit comments