From 16258d1c3317e1b00f0b9f9593f9055b9b6ffdfe Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Mon, 12 Feb 2024 02:22:10 +0000 Subject: [PATCH] version bumps --- src/isn.abst/isn.abst.csproj | 2 +- src/isn/Program.cs | 4 -- src/isn/Settings.cs | 14 +++--- src/isn/isn.csproj | 8 ++-- src/isnd/isnd.csproj | 28 ++++++------ test/isn.tests/PushTest.cs | 1 + test/isnd.tests/UnitTestWebHost.cs | 69 ++++++++++++++++-------------- test/isnd.tests/isnd.tests.csproj | 10 ++--- 8 files changed, 69 insertions(+), 67 deletions(-) diff --git a/src/isn.abst/isn.abst.csproj b/src/isn.abst/isn.abst.csproj index 84b9983..a1d69d1 100644 --- a/src/isn.abst/isn.abst.csproj +++ b/src/isn.abst/isn.abst.csproj @@ -9,6 +9,6 @@ 1.0.7+Branch.main.Sha.3695c1742965d93eba0ad851656cfaa3e44ba327 - + \ No newline at end of file diff --git a/src/isn/Program.cs b/src/isn/Program.cs index d57ef13..baf4906 100644 --- a/src/isn/Program.cs +++ b/src/isn/Program.cs @@ -17,10 +17,6 @@ namespace isn { var json = File.ReadAllText(cfgSettingIf.FullName); settings = JsonConvert.DeserializeObject(json); - if (settings.DefaultSourceKey == null) - { - Settings.DefaultSourceKey = settings.Sources.Keys.FirstOrDefault(); - } CurrentSource = settings.DefaultSourceKey; } } diff --git a/src/isn/Settings.cs b/src/isn/Settings.cs index 7756c94..98c6eee 100644 --- a/src/isn/Settings.cs +++ b/src/isn/Settings.cs @@ -12,7 +12,9 @@ namespace isn /// Protected API Key /// /// - public string ApiKey { get; set; } + public string ProtectedApiKey { get; set; } + + public string ApiKey { get; set; } /// /// Key alias @@ -22,19 +24,19 @@ namespace isn public string GetClearApiKey() { - return Protector.UnProtect(ApiKey); + if (!string.IsNullOrEmpty(ApiKey)) return ApiKey; + return ProtectedApiKey = Protector.UnProtect(ApiKey); } public void SetApiKey(string key) { - ApiKey = Protector.Protect(key); + ApiKey = key; + ProtectedApiKey = Protector.Protect(key); } - public static IDataProtector Protector { get; set; } = new DefaultDataProtector(); + public static IDataProtector Protector { get; private set ; } = new DefaultDataProtector(); } - - public class Settings { public string DataProtectionTitle { get; set; } diff --git a/src/isn/isn.csproj b/src/isn/isn.csproj index 1add3bd..dfbcadd 100644 --- a/src/isn/isn.csproj +++ b/src/isn/isn.csproj @@ -15,11 +15,11 @@ 1.0.7+Branch.main.Sha.3695c1742965d93eba0ad851656cfaa3e44ba327 - + - - - + + + \ No newline at end of file diff --git a/src/isnd/isnd.csproj b/src/isnd/isnd.csproj index c3c424c..2906be1 100644 --- a/src/isnd/isnd.csproj +++ b/src/isnd/isnd.csproj @@ -13,32 +13,32 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - - + + - - - - + + + + - - - + + + All - + - + diff --git a/test/isn.tests/PushTest.cs b/test/isn.tests/PushTest.cs index 057d9df..0f7b947 100644 --- a/test/isn.tests/PushTest.cs +++ b/test/isn.tests/PushTest.cs @@ -43,6 +43,7 @@ namespace isn.tests Assert.NotNull(vm); Assert.NotNull(vm.Resources); } + [Fact] public void TestPush() { diff --git a/test/isnd.tests/UnitTestWebHost.cs b/test/isnd.tests/UnitTestWebHost.cs index 96ba5fd..36b901b 100644 --- a/test/isnd.tests/UnitTestWebHost.cs +++ b/test/isnd.tests/UnitTestWebHost.cs @@ -17,7 +17,7 @@ using NuGet.Common; using System.Collections.Generic; namespace isnd.host.tests -{ +{ [Collection("Web server collection")] public class UnitTestWebHost : IClassFixture { @@ -42,14 +42,14 @@ namespace isnd.host.tests [Fact] void TestDropUser() { - + using (var serviceScope = server.Host.Services.CreateScope()) { var services = serviceScope.ServiceProvider; var dbContext = services.GetRequiredService(); var paul = dbContext.Users.FirstOrDefaultAsync (u => u.Email == "paul@pschneider.fr").Result; - if (paul!=null) + if (paul != null) { dbContext.Users.Remove(paul); dbContext.SaveChanges(); @@ -62,17 +62,18 @@ namespace isnd.host.tests public void NugetInstallsTest() { using (var serviceScope = server.Host.Services.CreateScope()) - { var isnSettings = serviceScope.ServiceProvider.GetService>().Value; - string pkgSourceUrl = isnSettings.ExternalUrl + apiindex; - ProcessStartInfo psi = new ProcessStartInfo("nuget"); - psi.ArgumentList.Add("install"); - psi.ArgumentList.Add("gitversion"); - psi.ArgumentList.Add("-PreRelease"); - psi.ArgumentList.Add("-Source"); - psi.ArgumentList.Add(pkgSourceUrl); - Process p = Process.Start(psi); - p.WaitForExit(); - Assert.True(p.ExitCode == 0, "nuget install failed!"); + { + var isnSettings = serviceScope.ServiceProvider.GetService>().Value; + string pkgSourceUrl = isnSettings.ExternalUrl + apiindex; + ProcessStartInfo psi = new ProcessStartInfo("nuget"); + psi.ArgumentList.Add("install"); + psi.ArgumentList.Add("gitversion"); + psi.ArgumentList.Add("-PreRelease"); + psi.ArgumentList.Add("-Source"); + psi.ArgumentList.Add(pkgSourceUrl); + Process p = Process.Start(psi); + p.WaitForExit(); + Assert.True(p.ExitCode == 0, "nuget install failed!"); } } @@ -80,29 +81,30 @@ namespace isnd.host.tests public void TestRegistrationV3Resource() { using (var serviceScope = server.Host.Services.CreateScope()) - { var isnSettings = serviceScope.ServiceProvider.GetService>().Value; - string pkgSourceUrl = isnSettings.ExternalUrl + apiindex; - NullThrottle throttle = new NullThrottle(); - - PackageSource packageSource = new PackageSource(pkgSourceUrl); - HttpSource client = new HttpSource(packageSource, PkgSourceMessageHandler, throttle); - NuGet.Protocol.RegistrationResourceV3 res = new NuGet.Protocol.RegistrationResourceV3(client , - new Uri(isnSettings.ExternalUrl + Constants.ApiVersionPrefix + "/registration")); + { + var isnSettings = serviceScope.ServiceProvider.GetService>().Value; + string pkgSourceUrl = isnSettings.ExternalUrl + apiindex; + NullThrottle throttle = new NullThrottle(); + + PackageSource packageSource = new PackageSource(pkgSourceUrl); + HttpSource client = new HttpSource(packageSource, PkgSourceMessageHandler, throttle); + NuGet.Protocol.RegistrationResourceV3 res = new NuGet.Protocol.RegistrationResourceV3(client, + new Uri(isnSettings.ExternalUrl + Constants.ApiVersionPrefix + "/registration")); } } - + [Fact] public void TrueTestRegistrationV3Resource() { using (var serviceScope = server.Host.Services.CreateScope()) - { + { var isnSettings = serviceScope.ServiceProvider.GetService>().Value; - string pkgSourceUrl = isnSettings.ExternalUrl + apiindex; - var prov = new RegistrationResourceV3Provider(); - var source = new PackageSource(pkgSourceUrl); - var repo = new SourceRepository(source, new INuGetResourceProvider[]{ prov }); - prov.TryCreate(repo, CancellationToken.None); - + string pkgSourceUrl = isnSettings.ExternalUrl + apiindex; + var prov = new RegistrationResourceV3Provider(); + var source = new PackageSource(pkgSourceUrl); + var repo = new SourceRepository(source, new INuGetResourceProvider[] { prov }); + prov.TryCreate(repo, CancellationToken.None); + } } @@ -110,10 +112,11 @@ namespace isnd.host.tests { throw new NotImplementedException(); } - public string SPIIndexURI { + public string SPIIndexURI + { get => server.Addresses.First() + "/v3/index"; } - + [Fact] public async Task TestGetMetadataAsync() { @@ -142,7 +145,7 @@ namespace isnd.host.tests Console.WriteLine($"Description: {package.Description}"); } } - + [Fact] public async Task TestFindPackageAsync() { diff --git a/test/isnd.tests/isnd.tests.csproj b/test/isnd.tests/isnd.tests.csproj index b5e25b5..29c5b3d 100644 --- a/test/isnd.tests/isnd.tests.csproj +++ b/test/isnd.tests/isnd.tests.csproj @@ -10,12 +10,12 @@ 1.0.7 - - - + + + - - + +