Skip to content

Commit

Permalink
removed from address prop from ext model (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
acn-sbuad authored Oct 10, 2023
1 parent 6a13f0b commit d569f5e
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/Altinn.Notifications/Mappers/OrderMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static class OrderMapper
/// </summary>
public static NotificationOrderRequest MapToOrderRequest(this EmailNotificationOrderRequestExt extRequest, string creator)
{
var emailTemplate = new EmailTemplate(extRequest.FromAddress, extRequest.Subject, extRequest.Body, extRequest.ContentType);
var emailTemplate = new EmailTemplate(null, extRequest.Subject, extRequest.Body, extRequest.ContentType);

var recipients = new List<Recipient>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ namespace Altinn.Notifications.Models;
/// </remarks>
public class EmailNotificationOrderRequestExt
{
/// <summary>
/// Gets or sets the from address to use as sender of the email
/// </summary>
[JsonPropertyName("fromAddress")]
public string? FromAddress { get; set; }

/// <summary>
/// Gets or sets the subject of the email
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public EmailNotificationOrdersControllerTests(IntegrationTestWebApplicationFacto
{
Body = "email-body",
ContentType = EmailContentType.Html,
FromAddress = "[email protected]",
Recipients = new List<RecipientExt>() { new RecipientExt() { EmailAddress = "[email protected]" }, new RecipientExt() { EmailAddress = "[email protected]" } },
SendersReference = "senders-reference",
RequestedSendTime = DateTime.UtcNow,
Expand Down Expand Up @@ -181,8 +180,6 @@ public async Task Post_ServiceReturnsError_ServerError()
public async Task Post_ServiceReturnsOrder_Accepted()
{
// Arrange
string expectedFromAddress = "[email protected]";

Mock<IEmailNotificationOrderService> serviceMock = new();
serviceMock.Setup(s => s.RegisterEmailNotificationOrder(It.IsAny<NotificationOrderRequest>()))
.Callback<NotificationOrderRequest>(orderRequest =>
Expand All @@ -192,7 +189,7 @@ public async Task Post_ServiceReturnsOrder_Accepted()
.FirstOrDefault();

Assert.NotNull(emailTemplate);
Assert.Equal(expectedFromAddress, emailTemplate.FromAddress);
Assert.Equal(string.Empty, emailTemplate.FromAddress);
})
.ReturnsAsync((_order, null));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public PostTests(IntegrationTestWebApplicationFactory<EmailNotificationOrdersCon
{
Body = "email-body",
ContentType = EmailContentType.Html,
FromAddress = "[email protected]",
Recipients = new List<RecipientExt>()
{
new RecipientExt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ public void MapToOrderRequest_RecipientsProvided_AreEquivalent()
{
Body = "email-body",
ContentType = EmailContentType.Html,
FromAddress = "[email protected]",
Recipients = new List<RecipientExt>() { new RecipientExt() { EmailAddress = "[email protected]" }, new RecipientExt() { EmailAddress = "[email protected]" } },
SendersReference = "senders-reference",
RequestedSendTime = sendTime,
Expand All @@ -142,7 +141,7 @@ public void MapToOrderRequest_RecipientsProvided_AreEquivalent()
Templates = new List<INotificationTemplate>()
{
new EmailTemplate(
"[email protected]",
string.Empty,
"email-subject",
"email-body",
EmailContentType.Html)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public void Validate_RecipientProvided_ReturnsTrue()
var order = new EmailNotificationOrderRequestExt()
{
Subject = "This is an email subject",
FromAddress = "[email protected]",
Recipients = new List<RecipientExt>() { new RecipientExt() { Id = "16069412345", EmailAddress = "[email protected]" } },
Body = "This is an email body"
};
Expand All @@ -42,7 +41,6 @@ public void Validate_EmailNotDefinedForRecipient_ReturnFalse()
var order = new EmailNotificationOrderRequestExt()
{
Subject = "This is an email subject",
FromAddress = "[email protected]",
Recipients = new List<RecipientExt>() { new RecipientExt() { Id = "16069412345" } },
Body = "This is an email body"
};
Expand All @@ -59,7 +57,6 @@ public void Validate_SendTimePassed_ReturnsFalse()
var order = new EmailNotificationOrderRequestExt()
{
Subject = "This is an email subject",
FromAddress = "[email protected]",
Recipients = new List<RecipientExt>() { new RecipientExt() { Id = "16069412345", EmailAddress = "[email protected]" } },
Body = "This is an email body",
RequestedSendTime = DateTime.UtcNow.AddDays(-1)
Expand All @@ -76,7 +73,6 @@ public void Validate_SubjectMissing_ReturnsFalse()
{
var order = new EmailNotificationOrderRequestExt()
{
FromAddress = "[email protected]",
Recipients = new List<RecipientExt>() { new RecipientExt() { Id = "16069412345", EmailAddress = "[email protected]" } },
Body = "This is an email body"
};
Expand All @@ -92,7 +88,6 @@ public void Validate_BodyMissing_ReturnsFalse()
var order = new EmailNotificationOrderRequestExt()
{
Subject = "This is an email subject",
FromAddress = "[email protected]",
Recipients = new List<RecipientExt>() { new RecipientExt() { Id = "16069412345", EmailAddress = "[email protected]" } },
};

Expand Down

0 comments on commit d569f5e

Please sign in to comment.