|
4 | 4 | using System.Net;
|
5 | 5 | using System.Net.Security;
|
6 | 6 | using LibGit2Sharp.Tests.TestHelpers;
|
7 |
| -using LibGit2Sharp.Core; |
8 | 7 | using Xunit;
|
9 |
| -using Xunit.Extensions; |
10 | 8 |
|
11 | 9 | namespace LibGit2Sharp.Tests
|
12 | 10 | {
|
@@ -79,58 +77,58 @@ public void CustomSmartSubtransportTest(string scheme, string url)
|
79 | 77 | }
|
80 | 78 | }
|
81 | 79 |
|
82 |
| - [Theory] |
83 |
| - [InlineData("https", "https://bitbucket.org/libgit2/testgitrepository.git", "libgit3", "libgit3")] |
84 |
| - public void CanUseCredentials(string scheme, string url, string user, string pass) |
85 |
| - { |
86 |
| - string remoteName = "testRemote"; |
87 |
| - |
88 |
| - var scd = BuildSelfCleaningDirectory(); |
89 |
| - Repository.Init(scd.RootedDirectoryPath); |
90 |
| - |
91 |
| - SmartSubtransportRegistration<MockSmartSubtransport> registration = null; |
92 |
| - |
93 |
| - try |
94 |
| - { |
95 |
| - // Disable server certificate validation for testing. |
96 |
| - // Do *NOT* enable this in production. |
97 |
| - ServicePointManager.ServerCertificateValidationCallback = certificateValidationCallback; |
98 |
| - |
99 |
| - registration = GlobalSettings.RegisterSmartSubtransport<MockSmartSubtransport>(scheme); |
100 |
| - Assert.NotNull(registration); |
101 |
| - |
102 |
| - using (var repo = new Repository(scd.DirectoryPath)) |
103 |
| - { |
104 |
| - repo.Network.Remotes.Add(remoteName, url); |
105 |
| - |
106 |
| - // Set up structures for the expected results |
107 |
| - // and verifying the RemoteUpdateTips callback. |
108 |
| - TestRemoteInfo expectedResults = TestRemoteInfo.TestRemoteInstance; |
109 |
| - ExpectedFetchState expectedFetchState = new ExpectedFetchState(remoteName); |
110 |
| - |
111 |
| - // Add expected branch objects |
112 |
| - foreach (KeyValuePair<string, ObjectId> kvp in expectedResults.BranchTips) |
113 |
| - { |
114 |
| - expectedFetchState.AddExpectedBranch(kvp.Key, ObjectId.Zero, kvp.Value); |
115 |
| - } |
116 |
| - |
117 |
| - // Perform the actual fetch |
118 |
| - Commands.Fetch(repo, remoteName, new string[0], new FetchOptions { |
119 |
| - OnUpdateTips = expectedFetchState.RemoteUpdateTipsHandler, TagFetchMode = TagFetchMode.Auto, |
120 |
| - CredentialsProvider = (_user, _valid, _hostname) => new UsernamePasswordCredentials() { Username = user, Password = pass }, |
121 |
| - }, null); |
122 |
| - |
123 |
| - // Verify the expected |
124 |
| - expectedFetchState.CheckUpdatedReferences(repo); |
125 |
| - } |
126 |
| - } |
127 |
| - finally |
128 |
| - { |
129 |
| - GlobalSettings.UnregisterSmartSubtransport(registration); |
130 |
| - |
131 |
| - ServicePointManager.ServerCertificateValidationCallback -= certificateValidationCallback; |
132 |
| - } |
133 |
| - } |
| 80 | + //[Theory] |
| 81 | + //[InlineData("https", "https://bitbucket.org/libgit2/testgitrepository.git", "libgit3", "libgit3")] |
| 82 | + //public void CanUseCredentials(string scheme, string url, string user, string pass) |
| 83 | + //{ |
| 84 | + // string remoteName = "testRemote"; |
| 85 | + |
| 86 | + // var scd = BuildSelfCleaningDirectory(); |
| 87 | + // Repository.Init(scd.RootedDirectoryPath); |
| 88 | + |
| 89 | + // SmartSubtransportRegistration<MockSmartSubtransport> registration = null; |
| 90 | + |
| 91 | + // try |
| 92 | + // { |
| 93 | + // // Disable server certificate validation for testing. |
| 94 | + // // Do *NOT* enable this in production. |
| 95 | + // ServicePointManager.ServerCertificateValidationCallback = certificateValidationCallback; |
| 96 | + |
| 97 | + // registration = GlobalSettings.RegisterSmartSubtransport<MockSmartSubtransport>(scheme); |
| 98 | + // Assert.NotNull(registration); |
| 99 | + |
| 100 | + // using (var repo = new Repository(scd.DirectoryPath)) |
| 101 | + // { |
| 102 | + // repo.Network.Remotes.Add(remoteName, url); |
| 103 | + |
| 104 | + // // Set up structures for the expected results |
| 105 | + // // and verifying the RemoteUpdateTips callback. |
| 106 | + // TestRemoteInfo expectedResults = TestRemoteInfo.TestRemoteInstance; |
| 107 | + // ExpectedFetchState expectedFetchState = new ExpectedFetchState(remoteName); |
| 108 | + |
| 109 | + // // Add expected branch objects |
| 110 | + // foreach (KeyValuePair<string, ObjectId> kvp in expectedResults.BranchTips) |
| 111 | + // { |
| 112 | + // expectedFetchState.AddExpectedBranch(kvp.Key, ObjectId.Zero, kvp.Value); |
| 113 | + // } |
| 114 | + |
| 115 | + // // Perform the actual fetch |
| 116 | + // Commands.Fetch(repo, remoteName, new string[0], new FetchOptions { |
| 117 | + // OnUpdateTips = expectedFetchState.RemoteUpdateTipsHandler, TagFetchMode = TagFetchMode.Auto, |
| 118 | + // CredentialsProvider = (_user, _valid, _hostname) => new UsernamePasswordCredentials() { Username = user, Password = pass }, |
| 119 | + // }, null); |
| 120 | + |
| 121 | + // // Verify the expected |
| 122 | + // expectedFetchState.CheckUpdatedReferences(repo); |
| 123 | + // } |
| 124 | + // } |
| 125 | + // finally |
| 126 | + // { |
| 127 | + // GlobalSettings.UnregisterSmartSubtransport(registration); |
| 128 | + |
| 129 | + // ServicePointManager.ServerCertificateValidationCallback -= certificateValidationCallback; |
| 130 | + // } |
| 131 | + //} |
134 | 132 |
|
135 | 133 | [Fact]
|
136 | 134 | public void CannotReregisterScheme()
|
|
0 commit comments