Comment out Bitbucket tests

上级 6490ff1e
......@@ -208,29 +208,29 @@ static Credentials CreateUsernamePasswordCredentials(string user, string pass, b
};
}
[Theory]
[InlineData("https://libgit2@bitbucket.org/libgit2/testgitrepository.git", "libgit3", "libgit3", true)]
[InlineData("https://libgit2@bitbucket.org/libgit2/testgitrepository.git", "libgit3", "libgit3", false)]
public void CanCloneFromBBWithCredentials(string url, string user, string pass, bool secure)
{
var scd = BuildSelfCleaningDirectory();
string clonedRepoPath = Repository.Clone(url, scd.DirectoryPath, new CloneOptions()
{
CredentialsProvider = (_url, _user, _cred) => CreateUsernamePasswordCredentials(user, pass, secure)
});
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);
}
}
//[Theory]
//[InlineData("https://libgit2@bitbucket.org/libgit2/testgitrepository.git", "libgit3", "libgit3", true)]
//[InlineData("https://libgit2@bitbucket.org/libgit2/testgitrepository.git", "libgit3", "libgit3", false)]
//public void CanCloneFromBBWithCredentials(string url, string user, string pass, bool secure)
//{
// var scd = BuildSelfCleaningDirectory();
// string clonedRepoPath = Repository.Clone(url, scd.DirectoryPath, new CloneOptions()
// {
// CredentialsProvider = (_url, _user, _cred) => CreateUsernamePasswordCredentials(user, pass, secure)
// });
// 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);
// }
//}
[SkippableTheory]
[InlineData("https://github.com/libgit2/TestGitRepository.git", "github.com", typeof(CertificateX509))]
......
......@@ -4,9 +4,7 @@
using System.Net;
using System.Net.Security;
using LibGit2Sharp.Tests.TestHelpers;
using LibGit2Sharp.Core;
using Xunit;
using Xunit.Extensions;
namespace LibGit2Sharp.Tests
{
......@@ -79,58 +77,58 @@ public void CustomSmartSubtransportTest(string scheme, string url)
}
}
[Theory]
[InlineData("https", "https://bitbucket.org/libgit2/testgitrepository.git", "libgit3", "libgit3")]
public void CanUseCredentials(string scheme, string url, string user, string pass)
{
string remoteName = "testRemote";
var scd = BuildSelfCleaningDirectory();
Repository.Init(scd.RootedDirectoryPath);
SmartSubtransportRegistration<MockSmartSubtransport> registration = null;
try
{
// Disable server certificate validation for testing.
// Do *NOT* enable this in production.
ServicePointManager.ServerCertificateValidationCallback = certificateValidationCallback;
registration = GlobalSettings.RegisterSmartSubtransport<MockSmartSubtransport>(scheme);
Assert.NotNull(registration);
using (var repo = new Repository(scd.DirectoryPath))
{
repo.Network.Remotes.Add(remoteName, url);
// Set up structures for the expected results
// and verifying the RemoteUpdateTips callback.
TestRemoteInfo expectedResults = TestRemoteInfo.TestRemoteInstance;
ExpectedFetchState expectedFetchState = new ExpectedFetchState(remoteName);
// Add expected branch objects
foreach (KeyValuePair<string, ObjectId> kvp in expectedResults.BranchTips)
{
expectedFetchState.AddExpectedBranch(kvp.Key, ObjectId.Zero, kvp.Value);
}
// Perform the actual fetch
Commands.Fetch(repo, remoteName, new string[0], new FetchOptions {
OnUpdateTips = expectedFetchState.RemoteUpdateTipsHandler, TagFetchMode = TagFetchMode.Auto,
CredentialsProvider = (_user, _valid, _hostname) => new UsernamePasswordCredentials() { Username = user, Password = pass },
}, null);
// Verify the expected
expectedFetchState.CheckUpdatedReferences(repo);
}
}
finally
{
GlobalSettings.UnregisterSmartSubtransport(registration);
ServicePointManager.ServerCertificateValidationCallback -= certificateValidationCallback;
}
}
//[Theory]
//[InlineData("https", "https://bitbucket.org/libgit2/testgitrepository.git", "libgit3", "libgit3")]
//public void CanUseCredentials(string scheme, string url, string user, string pass)
//{
// string remoteName = "testRemote";
// var scd = BuildSelfCleaningDirectory();
// Repository.Init(scd.RootedDirectoryPath);
// SmartSubtransportRegistration<MockSmartSubtransport> registration = null;
// try
// {
// // Disable server certificate validation for testing.
// // Do *NOT* enable this in production.
// ServicePointManager.ServerCertificateValidationCallback = certificateValidationCallback;
// registration = GlobalSettings.RegisterSmartSubtransport<MockSmartSubtransport>(scheme);
// Assert.NotNull(registration);
// using (var repo = new Repository(scd.DirectoryPath))
// {
// repo.Network.Remotes.Add(remoteName, url);
// // Set up structures for the expected results
// // and verifying the RemoteUpdateTips callback.
// TestRemoteInfo expectedResults = TestRemoteInfo.TestRemoteInstance;
// ExpectedFetchState expectedFetchState = new ExpectedFetchState(remoteName);
// // Add expected branch objects
// foreach (KeyValuePair<string, ObjectId> kvp in expectedResults.BranchTips)
// {
// expectedFetchState.AddExpectedBranch(kvp.Key, ObjectId.Zero, kvp.Value);
// }
// // Perform the actual fetch
// Commands.Fetch(repo, remoteName, new string[0], new FetchOptions {
// OnUpdateTips = expectedFetchState.RemoteUpdateTipsHandler, TagFetchMode = TagFetchMode.Auto,
// CredentialsProvider = (_user, _valid, _hostname) => new UsernamePasswordCredentials() { Username = user, Password = pass },
// }, null);
// // Verify the expected
// expectedFetchState.CheckUpdatedReferences(repo);
// }
// }
// finally
// {
// GlobalSettings.UnregisterSmartSubtransport(registration);
// ServicePointManager.ServerCertificateValidationCallback -= certificateValidationCallback;
// }
//}
[Fact]
public void CannotReregisterScheme()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册