mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2025-12-21 13:09:32 -06:00
experimenting with site scraping plugin
This commit is contained in:
35
SiteScraping/Tests/WebsiteScraperTests.cs
Normal file
35
SiteScraping/Tests/WebsiteScraperTests.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
#if(DEBUG)
|
||||
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace FileFlows.SiteScraping.Tests;
|
||||
|
||||
[TestClass]
|
||||
public class WebsiteScraperTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void WebsiteScrapperTest()
|
||||
{
|
||||
var logger = new TestLogger();
|
||||
string file = "/home/john/Pictures/scrapped/urls.txt";
|
||||
var temp = "/home/john/Pictures/scrapped/temp";
|
||||
if (Directory.Exists(temp) == false)
|
||||
Directory.CreateDirectory(temp);
|
||||
var args = new NodeParameters(file, logger, false, string.Empty, null)
|
||||
{
|
||||
TempPath = temp
|
||||
};
|
||||
|
||||
var node = new Scraping.WebImageScraper();
|
||||
node.MinHeight = 600;
|
||||
node.MinWidth = 600;
|
||||
node.MaxDepth = 2;
|
||||
var result = node.Execute(args);
|
||||
var log = logger.ToString();
|
||||
File.WriteAllText(Path.Combine(temp, "test.log"), log);
|
||||
Assert.AreEqual(1, result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user