mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2026-05-25 03:59:07 -05:00
Added WebRequest node
This commit is contained in:
@@ -4,6 +4,7 @@ namespace BasicNodes.Tests
|
||||
{
|
||||
using FileFlows.BasicNodes.File;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
[TestClass]
|
||||
public class ExecutorTests
|
||||
@@ -24,6 +25,11 @@ namespace BasicNodes.Tests
|
||||
string output = args.Variables["ExecOutput"] as string;
|
||||
Assert.IsNotNull(output);
|
||||
}
|
||||
[TestMethod]
|
||||
public void Executor_VariablePattern_Tests()
|
||||
{
|
||||
Assert.IsFalse(Regex.IsMatch(string.Empty, Executor.VariablePattern));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
#if(DEBUG)
|
||||
|
||||
namespace BasicNodes.Tests
|
||||
{
|
||||
using BasicNodes.Tools;
|
||||
using FileFlows.BasicNodes.File;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
[TestClass]
|
||||
public class WebRequestTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void WebRequest_PostJson()
|
||||
{
|
||||
var logger = new TestLogger();
|
||||
var args = new FileFlows.Plugin.NodeParameters(@"c:\test\testfile.mkv", logger, false, string.Empty);
|
||||
|
||||
WebRequest node = new();
|
||||
node.Method = "POST";
|
||||
node.Url = "http://localhost:7096/Users/New";
|
||||
node.ContentType = "application/json";
|
||||
node.Headers = new List<KeyValuePair<string, string>>();
|
||||
node.Headers.Add(new KeyValuePair<string, string> ("X-MediaBrowser-Token", ""));
|
||||
node.Body = @$"{{
|
||||
""Name"": ""{Guid.NewGuid()}""
|
||||
}}";
|
||||
|
||||
var result = node.Execute(args);
|
||||
|
||||
string body = node.Variables["web.Body"] as string;
|
||||
Assert.IsFalse(string.IsNullOrWhiteSpace(body));
|
||||
|
||||
Assert.AreEqual(1, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user