Skip to content

Commit

Permalink
Comment out Bitbucket tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bording committed Apr 1, 2022
1 parent 6490ff1 commit 4731263
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 77 deletions.
46 changes: 23 additions & 23 deletions LibGit2Sharp.Tests/CloneFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,29 +208,29 @@ static Credentials CreateUsernamePasswordCredentials(string user, string pass, b
};
}

[Theory]
[InlineData("https://[email protected]/libgit2/testgitrepository.git", "libgit3", "libgit3", true)]
[InlineData("https://[email protected]/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://[email protected]/libgit2/testgitrepository.git", "libgit3", "libgit3", true)]
//[InlineData("https://[email protected]/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))]
Expand Down
106 changes: 52 additions & 54 deletions LibGit2Sharp.Tests/desktop/SmartSubtransportFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 4731263

Please sign in to comment.