Compare commits
No commits in common. "truststore" and "main" have entirely different histories.
truststore
...
main
@ -6,8 +6,6 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
{
|
{
|
||||||
using System.Text.Encodings.Web;
|
using System.Text.Encodings.Web;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Python.Runtime;
|
|
||||||
|
|
||||||
internal class Config
|
internal class Config
|
||||||
{
|
{
|
||||||
public string apiUrl;
|
public string apiUrl;
|
||||||
@ -58,41 +56,6 @@ namespace dopt.DeltaBarth.Tests
|
|||||||
{
|
{
|
||||||
base.Setup(datenPfad, basisApiUrl);
|
base.Setup(datenPfad, basisApiUrl);
|
||||||
}
|
}
|
||||||
public void TruststoreInjected()
|
|
||||||
{
|
|
||||||
using (Py.GIL())
|
|
||||||
{
|
|
||||||
string code = @"
|
|
||||||
import pip_system_certs.wrapt_requests
|
|
||||||
pip_system_certs.wrapt_requests.inject_truststore()
|
|
||||||
import ssl
|
|
||||||
var1 = str(ssl.create_default_context())
|
|
||||||
var2 = str(ssl.get_default_verify_paths())
|
|
||||||
";
|
|
||||||
dynamic pyScope = Py.CreateScope();
|
|
||||||
pyScope.Exec(code);
|
|
||||||
dynamic var1 = pyScope.Get("var1");
|
|
||||||
dynamic var2 = pyScope.Get("var2");
|
|
||||||
Console.WriteLine($"Retrieved from Python: {var1}, {var2}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void TruststoreDefault()
|
|
||||||
{
|
|
||||||
using (Py.GIL())
|
|
||||||
{
|
|
||||||
string code = @"
|
|
||||||
import ssl
|
|
||||||
var1 = str(ssl.create_default_context())
|
|
||||||
var2 = str(ssl.get_default_verify_paths())
|
|
||||||
";
|
|
||||||
dynamic pyScope = Py.CreateScope();
|
|
||||||
pyScope.Exec(code);
|
|
||||||
dynamic var1 = pyScope.Get("var1");
|
|
||||||
dynamic var2 = pyScope.Get("var2");
|
|
||||||
Console.WriteLine($"Retrieved from Python: {var1}, {var2}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
[TestClass]
|
[TestClass]
|
||||||
public sealed class PluginTest
|
public sealed class PluginTest
|
||||||
@ -304,19 +267,5 @@ var2 = str(ssl.get_default_verify_paths())
|
|||||||
Assert.AreEqual((int)StatusCodes.VerbindungTimeout, res.status.code);
|
Assert.AreEqual((int)StatusCodes.VerbindungTimeout, res.status.code);
|
||||||
test.Dispose();
|
test.Dispose();
|
||||||
}
|
}
|
||||||
[TestMethod]
|
|
||||||
public void Set_SSLCertPaths_Inject_Test()
|
|
||||||
{
|
|
||||||
var test = new TPlugin();
|
|
||||||
test.TruststoreInjected();
|
|
||||||
test.Dispose();
|
|
||||||
}
|
|
||||||
[TestMethod]
|
|
||||||
public void Set_SSLCertPaths_Default_Test()
|
|
||||||
{
|
|
||||||
var test = new TPlugin();
|
|
||||||
test.TruststoreDefault();
|
|
||||||
test.Dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user