paypro: fix mock server. unit controller tests.
This commit is contained in:
parent
b89ad8f3cc
commit
1c4d292a96
3 changed files with 35 additions and 7 deletions
|
|
@ -93,13 +93,18 @@ x509.der = new Buffer(x509.der, 'base64');
|
|||
x509.pem = new Buffer(x509.pem, 'base64');
|
||||
|
||||
function startServer(cb) {
|
||||
if (G.$http.__server) {
|
||||
if (G.$http && G.$http.__server) {
|
||||
setTimeout(function() {
|
||||
return cb(null, G.$http.__server);
|
||||
}, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
var old;
|
||||
if (G.$http) {
|
||||
old = G.$http;
|
||||
}
|
||||
|
||||
var server = {
|
||||
POST: {
|
||||
|
||||
|
|
@ -271,9 +276,12 @@ function startServer(cb) {
|
|||
return cb(null, res, res.body);
|
||||
}
|
||||
},
|
||||
listen: function() {
|
||||
listen: function(port, cb) {
|
||||
if (cb) return cb();
|
||||
},
|
||||
close: function() {
|
||||
close: function(cb) {
|
||||
if (old) G.$http = old;
|
||||
return cb();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue