Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-06-13 22:42:38 +0400
committernulltoken <emeric.fermas@gmail.com>2014-06-14 16:56:17 +0400
commitc08840643f084bec44192fba78ed73d4934b803c (patch)
tree118aa588afaa94f9434b6bce3926e612397d58c7 /LibGit2Sharp.Tests
parent6eee53c02f0eb5019f6ae7b489dc34586013ca27 (diff)
Add Clone() test leveraging authentication
Diffstat (limited to 'LibGit2Sharp.Tests')
-rw-r--r--LibGit2Sharp.Tests/CloneFixture.cs25
1 files changed, 25 insertions, 0 deletions
diff --git a/LibGit2Sharp.Tests/CloneFixture.cs b/LibGit2Sharp.Tests/CloneFixture.cs
index 3888bee1..efec4793 100644
--- a/LibGit2Sharp.Tests/CloneFixture.cs
+++ b/LibGit2Sharp.Tests/CloneFixture.cs
@@ -166,5 +166,30 @@ namespace LibGit2Sharp.Tests
Assert.False(repo.Info.IsBare);
}
}
+
+ [Theory]
+ [InlineData("https://libgit2@bitbucket.org/libgit2/testgitrepository.git", "libgit3", "libgit3")]
+ public void CanCloneFromBBWithCredentials(string url, string user, string pass)
+ {
+ var scd = BuildSelfCleaningDirectory();
+
+ string clonedRepoPath = Repository.Clone(url, scd.DirectoryPath, new CloneOptions() {
+ CredentialsProvider = (_url, _user, _cred) => new UsernamePasswordCredentials {
+ Username = user,
+ Password = pass,
+ }
+ });
+
+ using (var repo = new Repository(clonedRepoPath))
+ {
+ string dir = repo.Info.Path;
+ Assert.True(Path.IsPathRooted(dir));
+ Assert.True(Directory.Exists(dir));
+
+ Assert.NotNull(repo.Info.WorkingDirectory);
+ Assert.Equal(Path.Combine(scd.RootedDirectoryPath, ".git" + Path.DirectorySeparatorChar), repo.Info.Path);
+ Assert.False(repo.Info.IsBare);
+ }
+ }
}
}