@@ -5,13 +5,15 @@ var _ = require("lodash");
55var fp = require ( "lodash/fp" ) ;
66
77var garbageCollect = require ( "../utils/garbage_collect.js" ) ;
8+ var RepoUtils = require ( "../utils/repository_setup" ) ;
89
910describe ( "Remote" , function ( ) {
1011 var NodeGit = require ( "../../" ) ;
1112 var Repository = NodeGit . Repository ;
1213 var Remote = NodeGit . Remote ;
1314
1415 var reposPath = local ( "../repos/workdir" ) ;
16+ var bareReposPath = local ( "../repos/bare" ) ;
1517 var url = "https://github.com/nodegit/test" ;
1618 var url2 = "https://github.com/nodegit/test2" ;
1719 var privateUrl = "git@github.com:nodegit/private" ;
@@ -133,34 +135,33 @@ describe("Remote", function() {
133135 var repo = this . repository ;
134136 var wasCalled = false ;
135137
136- // NOTE: This doesn't work, the credentials callback fails.
137- // Did manage to get it working by setting up a local bare repo and pushing to it.
138-
139- return Remote . create ( repo , "test2" , url2 )
140- . then ( function ( remote ) {
141- var fetchOpts = {
142- callbacks : {
143- credentials : function ( url , userName ) {
144- return NodeGit . Cred . sshKeyFromAgent ( userName ) ;
145- } ,
146- certificateCheck : function ( ) {
147- return 1 ;
148- } ,
149- pushTransferProgress : function ( ) {
150- wasCalled = true ;
151- }
152- }
153- } ;
154-
155- var ref = "refs/heads/master" ;
156- var refs = [ ref + ":" + ref ] ;
157- return remote . push ( refs , fetchOpts ) ;
158- } )
138+ return RepoUtils . createRepository ( bareReposPath , 1 )
159139 . then ( function ( ) {
160- assert . ok ( wasCalled ) ;
140+ return Remote . create ( repo , "bare" , bareReposPath )
141+ . then ( function ( remote ) {
142+ var fetchOpts = {
143+ callbacks : {
144+ credentials : function ( url , userName ) {
145+ return 1 ;
146+ } ,
147+ certificateCheck : function ( ) {
148+ return 1 ;
149+ } ,
150+ pushTransferProgress : function ( a , b , c ) {
151+ wasCalled = true ;
152+ }
153+ }
154+ } ;
161155
162- return Remote . delete ( repo , "test2" ) ;
163- } ) ;
156+ var ref = "refs/heads/master" ;
157+ var refs = [ ref + ":" + ref ] ;
158+
159+ return remote . push ( refs , fetchOpts )
160+ . then ( function ( res ) {
161+ assert . ok ( wasCalled ) ;
162+ } ) ;
163+ } ) ;
164+ } ) ;
164165 } ) ;
165166
166167 it ( "can monitor transfer progress while downloading" , function ( ) {
0 commit comments