@@ -75,6 +75,40 @@ describe('Acceptance: ng github-pages:deploy', function() {
75
75
return ng ( [ 'github-pages:deploy' , '--skip-build' ] ) ;
76
76
} ) ;
77
77
78
+ it ( 'should deploy with token and username' , function ( ) {
79
+ let token = 'token' ,
80
+ username = 'bar' ;
81
+
82
+ execStub . addExecSuccess ( 'git status --porcelain' )
83
+ . addExecSuccess ( 'git rev-parse --abbrev-ref HEAD' , initialBranch )
84
+ . addExecSuccess ( 'git remote -v' , remote )
85
+ . addExecSuccess ( `git checkout ${ ghPagesBranch } ` )
86
+ . addExecSuccess ( 'git add .' )
87
+ . addExecSuccess ( `git commit -m "${ message } "` )
88
+ . addExecSuccess ( `git checkout ${ initialBranch } ` )
89
+ . addExecSuccess ( `git push https://${ token } @github.com/${ username } /${ project } .git ${ ghPagesBranch } :${ ghPagesBranch } ` )
90
+ . addExecSuccess ( 'git remote -v' , remote ) ;
91
+
92
+ return ng ( [ 'github-pages:deploy' , '--skip-build' , `--gh-token=${ token } ` , `--gh-username=${ username } ` ] ) ;
93
+ } )
94
+
95
+ it ( 'should deploy with token only' , function ( ) {
96
+ let token = 'token' ;
97
+
98
+ execStub . addExecSuccess ( 'git status --porcelain' )
99
+ . addExecSuccess ( 'git rev-parse --abbrev-ref HEAD' , initialBranch )
100
+ . addExecSuccess ( 'git remote -v' , remote )
101
+ . addExecSuccess ( `git checkout ${ ghPagesBranch } ` )
102
+ . addExecSuccess ( 'git add .' )
103
+ . addExecSuccess ( `git commit -m "${ message } "` )
104
+ . addExecSuccess ( `git checkout ${ initialBranch } ` )
105
+ . addExecSuccess ( 'git remote -v' , remote )
106
+ . addExecSuccess ( `git push https://${ token } @github.com/username/${ project } .git ${ ghPagesBranch } :${ ghPagesBranch } ` )
107
+ . addExecSuccess ( 'git remote -v' , remote ) ;
108
+
109
+ return ng ( [ 'github-pages:deploy' , '--skip-build' , `--gh-token=${ token } ` ] ) ;
110
+ } ) ;
111
+
78
112
it ( 'should deploy with changed defaults' , function ( ) {
79
113
let userPageBranch = 'master' ,
80
114
message = 'not new gh-pages version' ;
@@ -120,12 +154,12 @@ describe('Acceptance: ng github-pages:deploy', function() {
120
154
. addExecSuccess ( 'git rev-parse --abbrev-ref HEAD' , initialBranch )
121
155
. addExecSuccess ( 'git remote -v' , noRemote )
122
156
. addExecSuccess ( `git remote add origin [email protected] :${ username } /${ project } .git` )
123
- . addExecSuccess ( `git push -u origin ${ initialBranch } ` )
157
+ . addExecSuccess ( `git push -u https:// ${ token } @github.com/ ${ username } / ${ project } .git ${ initialBranch } ` )
124
158
. addExecSuccess ( `git checkout ${ ghPagesBranch } ` )
125
159
. addExecSuccess ( 'git add .' )
126
160
. addExecSuccess ( `git commit -m "${ message } "` )
127
161
. addExecSuccess ( `git checkout ${ initialBranch } ` )
128
- . addExecSuccess ( `git push origin ${ ghPagesBranch } :${ ghPagesBranch } ` )
162
+ . addExecSuccess ( `git push https:// ${ token } @github.com/ ${ username } / ${ project } .git ${ ghPagesBranch } :${ ghPagesBranch } ` )
129
163
. addExecSuccess ( 'git remote -v' , remote ) ;
130
164
131
165
var httpsStub = sinon . stub ( https , 'request' , httpsRequestStubFunc ) ;
0 commit comments