diff options
author | Carlos MartÃn Nieto <cmn@dwim.me> | 2014-06-13 22:42:38 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2014-06-14 16:56:17 +0400 |
commit | c08840643f084bec44192fba78ed73d4934b803c (patch) | |
tree | 118aa588afaa94f9434b6bce3926e612397d58c7 /LibGit2Sharp.Tests | |
parent | 6eee53c02f0eb5019f6ae7b489dc34586013ca27 (diff) |
Add Clone() test leveraging authentication
Diffstat (limited to 'LibGit2Sharp.Tests')
-rw-r--r-- | LibGit2Sharp.Tests/CloneFixture.cs | 25 |
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); + } + } } } |