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