-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #833 from Project-MONAI/AC-2258
fixing email validation
- Loading branch information
Showing
3 changed files
with
101 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
*/ | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Extensions.Options; | ||
|
@@ -722,6 +723,100 @@ public async Task ValidateWorkflow_ValidatesEmptyWorkflow_ReturnsErrorsAndHasCor | |
Assert.Contains(error4, errors); | ||
} | ||
|
||
//"metadata_values": "Study Instance UID, Series Instance UID" | ||
[Fact] | ||
public async Task ValidateWorkflow_ValidateWorkflow_WithPluginArgs_ReturnsNoErrors() | ||
{ | ||
var workflow = new Workflow | ||
{ | ||
Name = "Workflowname1", | ||
Description = "Workflowdesc1", | ||
Version = "1", | ||
InformaticsGateway = new InformaticsGateway | ||
{ | ||
AeTitle = "aetitle", | ||
ExportDestinations = new string[] { "oneDestination", "twoDestination", "threeDestination" } | ||
}, | ||
Tasks = new TaskObject[] | ||
{ | ||
new TaskObject | ||
{ | ||
Id = "rootTask", | ||
Type = "router", | ||
Description = "TestDesc", | ||
TaskDestinations = new TaskDestination[] | ||
{ | ||
new TaskDestination | ||
{ | ||
Name = "EmailTask" | ||
} | ||
}, | ||
ExportDestinations = new ExportDestination[] | ||
{ | ||
new ExportDestination { Name = "oneDestination" }, | ||
new ExportDestination { Name = "twoDestination" }, | ||
}, | ||
Artifacts = new ArtifactMap | ||
{ | ||
Output = new Artifact[] | ||
{ | ||
new Artifact | ||
{ | ||
Name = "non_unique_artifact", | ||
Mandatory = true, | ||
Value = "Example Value" | ||
} | ||
} | ||
} | ||
}, | ||
|
||
#region SuccessfulTasksPath | ||
|
||
new TaskObject | ||
{ | ||
|
||
Id = "EmailTask", | ||
Type = "email", | ||
Description = "Email plugin Task 1", | ||
Artifacts = new ArtifactMap{ Input = new Artifact[] { | ||
new Artifact | ||
{ | ||
Name = "ExampleArtifact", | ||
Value = "{{ context.value.EmailTask_InvalidEmailsArg.artifact.test }}" | ||
}, | ||
} }, | ||
Args = new Dictionary<string, string>{ | ||
{ "metadata_values", "Study Instance UID, Series Instance UID"}, | ||
{ "workflow_name", "Workflow Name"}, | ||
{ "recipient_emails", "[email protected]"} | ||
}, | ||
TaskDestinations = new TaskDestination[] { | ||
new TaskDestination | ||
{ | ||
Name = "taskdesc2" | ||
} | ||
} | ||
}, | ||
new TaskObject | ||
{ | ||
Id = "taskdesc2", | ||
Type = "router", | ||
Description = "TestDesc", | ||
TaskDestinations = Array.Empty<TaskDestination>() | ||
} | ||
#endregion SuccessfulTasksPath | ||
} | ||
}; | ||
|
||
_workflowService.Setup(w => w.GetByNameAsync(It.IsAny<string>())) | ||
.ReturnsAsync(null, TimeSpan.FromSeconds(.1)); | ||
|
||
var errors = await _workflowValidator.ValidateWorkflow(workflow); | ||
|
||
Assert.True(errors.Count == 0); | ||
|
||
} | ||
|
||
[Fact] | ||
public async Task ValidateWorkflow_ValidateWorkflow_ReturnsNoErrors() | ||
{ | ||
|