James Tombleson
799668a059
* Still working though it but looking good on releases * added the example discord message test * updated source repo to return an existing record before a new is added * updated the sources repo interface * updated new routes to check for existing records * starting to migrate the seed out of the sql migrations * A new seed script was made to reload the db from the api * Docker image works locally * Adding CI to build docker image * ... disabled swagger so I can test docker * Added more to the github job but its not finished. Isnt pulling sources yet. * cleaned up formatting * Controller updates to look for existing records when requesting a new one * null check cleanup * namespace fix
40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using Newsbot.Collector.Domain.Models;
|
|
using Newsbot.Collector.Services.Jobs;
|
|
using Newsbot.Collector.Services.Notifications.Discord;
|
|
|
|
namespace Newsbot.Collector.Tests.Jobs;
|
|
|
|
public class DiscordNotificationJobTest
|
|
{
|
|
|
|
[Fact]
|
|
public void PostTestMessage()
|
|
{
|
|
var uri = "";
|
|
var webhookClient = new DiscordWebhookClient(uri);
|
|
|
|
var client = new DiscordNotificationJob();
|
|
var msg = client.GenerateDiscordMessage(new SourceModel
|
|
{
|
|
ID = Guid.NewGuid(),
|
|
Site = "Unit Test",
|
|
Source = "placeholder",
|
|
Type = "a",
|
|
Value = "a",
|
|
Enabled = true,
|
|
Url = "https://github.com",
|
|
Tags = "Unit, Testing",
|
|
},
|
|
new ArticlesModel
|
|
{
|
|
Tags = "more,unit,testing",
|
|
Title = "Nope not real",
|
|
URL = "https://github.com/jtom38",
|
|
PubDate = DateTime.Now,
|
|
Thumbnail = "https://cdn.arstechnica.net/wp-content/uploads/2023/03/GettyImages-944827400-800x534.jpg",
|
|
Description = "Please work",
|
|
AuthorName = "No one knows"
|
|
});
|
|
webhookClient.SendMessage(msg);
|
|
}
|
|
} |