new mailling for not confirmed emails
This commit is contained in:
29
test/yavscTests/NonRegression/AbstractTests.cs
Normal file
29
test/yavscTests/NonRegression/AbstractTests.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using Yavsc.Helpers;
|
||||
|
||||
namespace test
|
||||
{
|
||||
[Collection("Yavsc Abstract tests")]
|
||||
[Trait("regression", "II")]
|
||||
public class AbstractTests
|
||||
{
|
||||
readonly ITestOutputHelper output;
|
||||
public AbstractTests(ITestOutputHelper output)
|
||||
{
|
||||
this.output = output;
|
||||
}
|
||||
[Fact]
|
||||
public void UniquePathesAfterFileNameCleaning()
|
||||
{
|
||||
var name1 = "content:///scanned_files/2020-06-02/00.11.02.JPG";
|
||||
var name2 = "content:///scanned_files/2020-06-02/00.11.03.JPG";
|
||||
var cleanName1 = AbstractFileSystemHelpers.FilterFileName(name1);
|
||||
var cleanName2 = AbstractFileSystemHelpers.FilterFileName(name2);
|
||||
output.WriteLine($"{name1} => {cleanName1}");
|
||||
output.WriteLine($"{name2} => {cleanName2}");
|
||||
Assert.True(cleanName1 != cleanName2);
|
||||
}
|
||||
}
|
||||
}
|
48
test/yavscTests/NonRegression/Database.cs
Normal file
48
test/yavscTests/NonRegression/Database.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace test.Mandatory
|
||||
{
|
||||
[Collection("Database")]
|
||||
[Trait("regression", "II")]
|
||||
[Trait("dev", "wip")]
|
||||
public class Database: IClassFixture<ServerSideFixture>, IDisposable
|
||||
{
|
||||
readonly ServerSideFixture _serverFixture;
|
||||
readonly ITestOutputHelper output;
|
||||
public Database(ServerSideFixture serverFixture, ITestOutputHelper output)
|
||||
{
|
||||
this.output = output;
|
||||
_serverFixture = serverFixture;
|
||||
try {
|
||||
if (_serverFixture.DbCreated)
|
||||
|
||||
_serverFixture.DropTestDb();
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
output.WriteLine("db not dropped");
|
||||
}
|
||||
output.WriteLine($"Startup.Testing.ConnectionStrings.DatabaseCtor is {Startup.Testing.ConnectionStrings.DatabaseCtor}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Assuming we're using an account that may create databases,
|
||||
/// Install all our migrations in a fresh new database.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void InstallFromScratchUsingPoweredNpgsqlUser()
|
||||
{
|
||||
_serverFixture.EnsureTestDb();
|
||||
_serverFixture.UpgradeDb();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_serverFixture.DropTestDb();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
44
test/yavscTests/NonRegression/EMailling.cs
Normal file
44
test/yavscTests/NonRegression/EMailling.cs
Normal file
@ -0,0 +1,44 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using Yavsc.Abstract.Manage;
|
||||
|
||||
namespace test
|
||||
{
|
||||
|
||||
[Collection("EMaillingTeststCollection")]
|
||||
[Trait("regression", "II")]
|
||||
public class EMaillingTests : IClassFixture<ServerSideFixture>
|
||||
|
||||
{
|
||||
readonly ServerSideFixture _serverFixture;
|
||||
readonly ITestOutputHelper output;
|
||||
readonly ILogger _logger;
|
||||
public EMaillingTests(ServerSideFixture serverFixture, ITestOutputHelper output)
|
||||
{
|
||||
this.output = output;
|
||||
_serverFixture = serverFixture;
|
||||
_logger = serverFixture.Logger;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SendEMailSynchrone()
|
||||
{
|
||||
|
||||
AssertAsync.CompletesIn(2, () =>
|
||||
{
|
||||
output.WriteLine("SendEMailSynchrone ...");
|
||||
EmailSentViewModel mailSentInfo = _serverFixture.MailSender.SendEmailAsync
|
||||
(_serverFixture.SiteSetup.Owner.Name, _serverFixture.SiteSetup.Owner.EMail, $"monthly email", "test boby monthly email").Result;
|
||||
if (mailSentInfo==null)
|
||||
_logger.LogError("No info on sending");
|
||||
else if (!mailSentInfo.Sent)
|
||||
_logger.LogError($"{mailSentInfo.ErrorMessage}");
|
||||
else
|
||||
_logger.LogInformation($"mailId:{mailSentInfo.MessageId} \nto:{_serverFixture.SiteSetup.Owner.Name}");
|
||||
Assert.NotNull(mailSentInfo);
|
||||
output.WriteLine($">>done with {mailSentInfo.EMail} {mailSentInfo.Sent} {mailSentInfo.MessageId} {mailSentInfo.ErrorMessage}");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
66
test/yavscTests/NonRegression/NodeTests.cs
Executable file
66
test/yavscTests/NonRegression/NodeTests.cs
Executable file
@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using Xunit;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace test
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Since node isn't any requirement by here,
|
||||
/// It may regress
|
||||
/// </summary>
|
||||
[Trait("regression", "allways")]
|
||||
public class NodeTests
|
||||
{
|
||||
void TestNodeJsForAnsitohtml ()
|
||||
{
|
||||
var procStart = new ProcessStartInfo("node", "node_modules/ansi-to-html/bin/ansi-to-html")
|
||||
{
|
||||
UseShellExecute = false,
|
||||
RedirectStandardInput = true,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true
|
||||
};
|
||||
var proc = Process.Start(procStart);
|
||||
proc.StandardInput.WriteLine("\x001b[30mblack\x1b[37mwhite");
|
||||
proc.StandardInput.Close();
|
||||
while (!proc.StandardOutput.EndOfStream)
|
||||
{
|
||||
Console.Write(proc.StandardOutput.ReadToEnd());
|
||||
}
|
||||
}
|
||||
|
||||
void AnsiToHtml()
|
||||
{
|
||||
var procStart = new ProcessStartInfo("ls", "-l --color=always")
|
||||
{
|
||||
UseShellExecute = false,
|
||||
RedirectStandardInput = false,
|
||||
RedirectStandardOutput = true
|
||||
};
|
||||
var proc = Process.Start(procStart);
|
||||
var encoded = GetStream(proc.StandardOutput);
|
||||
var reader = new StreamReader(encoded);
|
||||
var txt = reader.ReadToEnd();
|
||||
|
||||
Console.WriteLine(txt);
|
||||
}
|
||||
|
||||
public static Stream GetStream(StreamReader reader)
|
||||
{
|
||||
var procStart = new ProcessStartInfo("node", "node_modules/ansi-to-html/bin/ansi-to-html");
|
||||
procStart.UseShellExecute = false;
|
||||
procStart.RedirectStandardInput = true;
|
||||
procStart.RedirectStandardOutput = true;
|
||||
procStart.RedirectStandardError = true;
|
||||
var mem = new MemoryStream();
|
||||
StreamWriter writer = new StreamWriter(mem);
|
||||
var proc = Process.Start(procStart);
|
||||
var text = reader.ReadToEnd();
|
||||
proc.StandardInput.WriteLine(text);
|
||||
proc.StandardInput.Close();
|
||||
return proc.StandardOutput.BaseStream;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user