From 6c574a6190cd8c8e063b488eab0f2efba88db7e2 Mon Sep 17 00:00:00 2001 From: Jacob Friis Saxberg Date: Fri, 15 Jul 2016 12:28:34 +0200 Subject: [PATCH 1/2] test example for repo 404 bug --- test/tests/clone.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/tests/clone.js b/test/tests/clone.js index 40c557dee..b7363cd37 100644 --- a/test/tests/clone.js +++ b/test/tests/clone.js @@ -314,4 +314,25 @@ describe("Clone", function() { } }).catch(function(reason) { }); }); + + it("should fail fast if repo not found", function() { + var url = "https://github.com/nodegit/test404.git"; + return Clone(url, clonePath, { + fetchOpts: { + callbacks: { + certificateCheck: function() { + return 1; + }, + credentials: function() { + return NodeGit.Cred.userpassPlaintextNew("fake-token", + "x-oauth-basic"); + } + } + } + }) + .catch(function(err) { + assert.ok(err); + }); + }); + }); From f4000cf2326da2360285838f22aafaecba45c1de Mon Sep 17 00:00:00 2001 From: Jacob Friis Saxberg Date: Fri, 15 Jul 2016 13:01:17 +0200 Subject: [PATCH 2/2] Bitbucket example --- test/tests/clone.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/test/tests/clone.js b/test/tests/clone.js index b7363cd37..df4bd943e 100644 --- a/test/tests/clone.js +++ b/test/tests/clone.js @@ -315,7 +315,7 @@ describe("Clone", function() { }).catch(function(reason) { }); }); - it("should fail fast if repo not found", function() { + it("should fail fast if repo not found [GitHub]", function() { var url = "https://github.com/nodegit/test404.git"; return Clone(url, clonePath, { fetchOpts: { @@ -335,4 +335,24 @@ describe("Clone", function() { }); }); + it("should fail fast if repo not found [Bitbucket]", function() { + var url = "https://bitbucket.org/nodegit/test404.git"; + return Clone(url, clonePath, { + fetchOpts: { + callbacks: { + certificateCheck: function() { + return 1; + }, + credentials: function() { + return NodeGit.Cred.userpassPlaintextNew("fake-token", + "x-oauth-basic"); + } + } + } + }) + .catch(function(err) { + assert.ok(err); + }); + }); + });