mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 08:32:50 -05:00
PM-15084: Consistent notification center push type names.
Renamed PushType's `SyncNotification` to `Notification`, since the push type payload does not require, is not dependent on the sync mechanism.
This commit is contained in:
@ -33,7 +33,7 @@ public class PushControllerTests
|
||||
var exception = await Assert.ThrowsAsync<BadRequestException>(() =>
|
||||
sutProvider.Sut.SendAsync(new PushSendRequestModel
|
||||
{
|
||||
Type = PushType.SyncNotification,
|
||||
Type = PushType.Notification,
|
||||
UserId = userId.ToString(),
|
||||
OrganizationId = organizationId.ToString(),
|
||||
InstallationId = installationId.ToString(),
|
||||
@ -63,7 +63,7 @@ public class PushControllerTests
|
||||
|
||||
await sutProvider.Sut.SendAsync(new PushSendRequestModel
|
||||
{
|
||||
Type = PushType.SyncNotification,
|
||||
Type = PushType.Notification,
|
||||
UserId = null,
|
||||
OrganizationId = null,
|
||||
InstallationId = null,
|
||||
@ -96,7 +96,7 @@ public class PushControllerTests
|
||||
|
||||
await sutProvider.Sut.SendAsync(new PushSendRequestModel
|
||||
{
|
||||
Type = PushType.SyncNotification,
|
||||
Type = PushType.Notification,
|
||||
UserId = userId.ToString(),
|
||||
OrganizationId = haveOrganizationId ? Guid.NewGuid().ToString() : null,
|
||||
InstallationId = null,
|
||||
@ -107,7 +107,7 @@ public class PushControllerTests
|
||||
});
|
||||
|
||||
await sutProvider.GetDependency<IPushNotificationService>().Received(1)
|
||||
.SendPayloadToUserAsync(expectedUserId, PushType.SyncNotification, "test-payload", expectedIdentifier,
|
||||
.SendPayloadToUserAsync(expectedUserId, PushType.Notification, "test-payload", expectedIdentifier,
|
||||
expectedDeviceId, ClientType.All);
|
||||
await sutProvider.GetDependency<IPushNotificationService>().Received(0)
|
||||
.SendPayloadToOrganizationAsync(Arg.Any<string>(), Arg.Any<PushType>(), Arg.Any<object>(),
|
||||
@ -132,7 +132,7 @@ public class PushControllerTests
|
||||
|
||||
await sutProvider.Sut.SendAsync(new PushSendRequestModel
|
||||
{
|
||||
Type = PushType.SyncNotification,
|
||||
Type = PushType.Notification,
|
||||
UserId = null,
|
||||
OrganizationId = organizationId.ToString(),
|
||||
InstallationId = null,
|
||||
@ -143,7 +143,7 @@ public class PushControllerTests
|
||||
});
|
||||
|
||||
await sutProvider.GetDependency<IPushNotificationService>().Received(1)
|
||||
.SendPayloadToOrganizationAsync(expectedOrganizationId, PushType.SyncNotification, "test-payload",
|
||||
.SendPayloadToOrganizationAsync(expectedOrganizationId, PushType.Notification, "test-payload",
|
||||
expectedIdentifier, expectedDeviceId, ClientType.All);
|
||||
await sutProvider.GetDependency<IPushNotificationService>().Received(0)
|
||||
.SendPayloadToUserAsync(Arg.Any<string>(), Arg.Any<PushType>(), Arg.Any<object>(), Arg.Any<string>(),
|
||||
@ -166,7 +166,7 @@ public class PushControllerTests
|
||||
|
||||
await sutProvider.Sut.SendAsync(new PushSendRequestModel
|
||||
{
|
||||
Type = PushType.SyncNotification,
|
||||
Type = PushType.Notification,
|
||||
UserId = null,
|
||||
OrganizationId = null,
|
||||
InstallationId = installationId.ToString(),
|
||||
@ -177,7 +177,7 @@ public class PushControllerTests
|
||||
});
|
||||
|
||||
await sutProvider.GetDependency<IPushNotificationService>().Received(1)
|
||||
.SendPayloadToInstallationAsync(installationId.ToString(), PushType.SyncNotification, "test-payload",
|
||||
.SendPayloadToInstallationAsync(installationId.ToString(), PushType.Notification, "test-payload",
|
||||
expectedIdentifier, expectedDeviceId, ClientType.All);
|
||||
await sutProvider.GetDependency<IPushNotificationService>().Received(0)
|
||||
.SendPayloadToOrganizationAsync(Arg.Any<string>(), Arg.Any<PushType>(), Arg.Any<object>(),
|
||||
@ -198,7 +198,7 @@ public class PushControllerTests
|
||||
var exception = await Assert.ThrowsAsync<BadRequestException>(() =>
|
||||
sutProvider.Sut.SendAsync(new PushSendRequestModel
|
||||
{
|
||||
Type = PushType.SyncNotification,
|
||||
Type = PushType.Notification,
|
||||
UserId = null,
|
||||
OrganizationId = null,
|
||||
InstallationId = Guid.NewGuid().ToString(),
|
||||
|
@ -47,12 +47,12 @@ public class NotificationHubPushNotificationServiceTests
|
||||
{
|
||||
sutProvider.GetDependency<IGlobalSettings>().Installation.Id = installationId;
|
||||
notification.ClientType = ClientType.All;
|
||||
var expectedSyncNotification = ToNotificationPushNotification(notification, null, installationId);
|
||||
var expectedNotification = ToNotificationPushNotification(notification, null, installationId);
|
||||
|
||||
await sutProvider.Sut.PushNotificationAsync(notification);
|
||||
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotification,
|
||||
expectedSyncNotification,
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.Notification,
|
||||
expectedNotification,
|
||||
$"(template:payload && installationId:{installationId})");
|
||||
await sutProvider.GetDependency<IInstallationDeviceRepository>()
|
||||
.Received(0)
|
||||
@ -71,12 +71,12 @@ public class NotificationHubPushNotificationServiceTests
|
||||
{
|
||||
sutProvider.GetDependency<IGlobalSettings>().Installation.Id = installationId;
|
||||
notification.ClientType = clientType;
|
||||
var expectedSyncNotification = ToNotificationPushNotification(notification, null, installationId);
|
||||
var expectedNotification = ToNotificationPushNotification(notification, null, installationId);
|
||||
|
||||
await sutProvider.Sut.PushNotificationAsync(notification);
|
||||
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotification,
|
||||
expectedSyncNotification,
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.Notification,
|
||||
expectedNotification,
|
||||
$"(template:payload && installationId:{installationId} && clientType:{clientType})");
|
||||
await sutProvider.GetDependency<IInstallationDeviceRepository>()
|
||||
.Received(0)
|
||||
@ -97,12 +97,12 @@ public class NotificationHubPushNotificationServiceTests
|
||||
}
|
||||
|
||||
notification.ClientType = ClientType.All;
|
||||
var expectedSyncNotification = ToNotificationPushNotification(notification, null, null);
|
||||
var expectedNotification = ToNotificationPushNotification(notification, null, null);
|
||||
|
||||
await sutProvider.Sut.PushNotificationAsync(notification);
|
||||
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotification,
|
||||
expectedSyncNotification,
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.Notification,
|
||||
expectedNotification,
|
||||
$"(template:payload_userId:{notification.UserId})");
|
||||
await sutProvider.GetDependency<IInstallationDeviceRepository>()
|
||||
.Received(0)
|
||||
@ -121,12 +121,12 @@ public class NotificationHubPushNotificationServiceTests
|
||||
{
|
||||
notification.OrganizationId = null;
|
||||
notification.ClientType = clientType;
|
||||
var expectedSyncNotification = ToNotificationPushNotification(notification, null, null);
|
||||
var expectedNotification = ToNotificationPushNotification(notification, null, null);
|
||||
|
||||
await sutProvider.Sut.PushNotificationAsync(notification);
|
||||
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotification,
|
||||
expectedSyncNotification,
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.Notification,
|
||||
expectedNotification,
|
||||
$"(template:payload_userId:{notification.UserId} && clientType:{clientType})");
|
||||
await sutProvider.GetDependency<IInstallationDeviceRepository>()
|
||||
.Received(0)
|
||||
@ -144,12 +144,12 @@ public class NotificationHubPushNotificationServiceTests
|
||||
Notification notification)
|
||||
{
|
||||
notification.ClientType = clientType;
|
||||
var expectedSyncNotification = ToNotificationPushNotification(notification, null, null);
|
||||
var expectedNotification = ToNotificationPushNotification(notification, null, null);
|
||||
|
||||
await sutProvider.Sut.PushNotificationAsync(notification);
|
||||
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotification,
|
||||
expectedSyncNotification,
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.Notification,
|
||||
expectedNotification,
|
||||
$"(template:payload_userId:{notification.UserId} && clientType:{clientType})");
|
||||
await sutProvider.GetDependency<IInstallationDeviceRepository>()
|
||||
.Received(0)
|
||||
@ -164,12 +164,12 @@ public class NotificationHubPushNotificationServiceTests
|
||||
{
|
||||
notification.UserId = null;
|
||||
notification.ClientType = ClientType.All;
|
||||
var expectedSyncNotification = ToNotificationPushNotification(notification, null, null);
|
||||
var expectedNotification = ToNotificationPushNotification(notification, null, null);
|
||||
|
||||
await sutProvider.Sut.PushNotificationAsync(notification);
|
||||
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotification,
|
||||
expectedSyncNotification,
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.Notification,
|
||||
expectedNotification,
|
||||
$"(template:payload && organizationId:{notification.OrganizationId})");
|
||||
await sutProvider.GetDependency<IInstallationDeviceRepository>()
|
||||
.Received(0)
|
||||
@ -188,12 +188,12 @@ public class NotificationHubPushNotificationServiceTests
|
||||
{
|
||||
notification.UserId = null;
|
||||
notification.ClientType = clientType;
|
||||
var expectedSyncNotification = ToNotificationPushNotification(notification, null, null);
|
||||
var expectedNotification = ToNotificationPushNotification(notification, null, null);
|
||||
|
||||
await sutProvider.Sut.PushNotificationAsync(notification);
|
||||
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotification,
|
||||
expectedSyncNotification,
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.Notification,
|
||||
expectedNotification,
|
||||
$"(template:payload && organizationId:{notification.OrganizationId} && clientType:{clientType})");
|
||||
await sutProvider.GetDependency<IInstallationDeviceRepository>()
|
||||
.Received(0)
|
||||
@ -231,12 +231,12 @@ public class NotificationHubPushNotificationServiceTests
|
||||
sutProvider.GetDependency<IGlobalSettings>().Installation.Id = installationId;
|
||||
notification.ClientType = ClientType.All;
|
||||
|
||||
var expectedSyncNotification = ToNotificationPushNotification(notification, notificationStatus, installationId);
|
||||
var expectedNotification = ToNotificationPushNotification(notification, notificationStatus, installationId);
|
||||
|
||||
await sutProvider.Sut.PushNotificationStatusAsync(notification, notificationStatus);
|
||||
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotificationStatus,
|
||||
expectedSyncNotification,
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.NotificationStatus,
|
||||
expectedNotification,
|
||||
$"(template:payload && installationId:{installationId})");
|
||||
await sutProvider.GetDependency<IInstallationDeviceRepository>()
|
||||
.Received(0)
|
||||
@ -257,12 +257,12 @@ public class NotificationHubPushNotificationServiceTests
|
||||
sutProvider.GetDependency<IGlobalSettings>().Installation.Id = installationId;
|
||||
notification.ClientType = clientType;
|
||||
|
||||
var expectedSyncNotification = ToNotificationPushNotification(notification, notificationStatus, installationId);
|
||||
var expectedNotification = ToNotificationPushNotification(notification, notificationStatus, installationId);
|
||||
|
||||
await sutProvider.Sut.PushNotificationStatusAsync(notification, notificationStatus);
|
||||
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotificationStatus,
|
||||
expectedSyncNotification,
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.NotificationStatus,
|
||||
expectedNotification,
|
||||
$"(template:payload && installationId:{installationId} && clientType:{clientType})");
|
||||
await sutProvider.GetDependency<IInstallationDeviceRepository>()
|
||||
.Received(0)
|
||||
@ -283,12 +283,12 @@ public class NotificationHubPushNotificationServiceTests
|
||||
}
|
||||
|
||||
notification.ClientType = ClientType.All;
|
||||
var expectedSyncNotification = ToNotificationPushNotification(notification, notificationStatus, null);
|
||||
var expectedNotification = ToNotificationPushNotification(notification, notificationStatus, null);
|
||||
|
||||
await sutProvider.Sut.PushNotificationStatusAsync(notification, notificationStatus);
|
||||
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotificationStatus,
|
||||
expectedSyncNotification,
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.NotificationStatus,
|
||||
expectedNotification,
|
||||
$"(template:payload_userId:{notification.UserId})");
|
||||
await sutProvider.GetDependency<IInstallationDeviceRepository>()
|
||||
.Received(0)
|
||||
@ -311,7 +311,7 @@ public class NotificationHubPushNotificationServiceTests
|
||||
|
||||
await sutProvider.Sut.PushNotificationStatusAsync(notification, notificationStatus);
|
||||
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotificationStatus,
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.NotificationStatus,
|
||||
expectedNotification,
|
||||
$"(template:payload_userId:{notification.UserId} && clientType:{clientType})");
|
||||
await sutProvider.GetDependency<IInstallationDeviceRepository>()
|
||||
@ -334,7 +334,7 @@ public class NotificationHubPushNotificationServiceTests
|
||||
|
||||
await sutProvider.Sut.PushNotificationStatusAsync(notification, notificationStatus);
|
||||
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotificationStatus,
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.NotificationStatus,
|
||||
expectedNotification,
|
||||
$"(template:payload_userId:{notification.UserId} && clientType:{clientType})");
|
||||
await sutProvider.GetDependency<IInstallationDeviceRepository>()
|
||||
@ -355,7 +355,7 @@ public class NotificationHubPushNotificationServiceTests
|
||||
|
||||
await sutProvider.Sut.PushNotificationStatusAsync(notification, notificationStatus);
|
||||
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotificationStatus,
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.NotificationStatus,
|
||||
expectedNotification,
|
||||
$"(template:payload && organizationId:{notification.OrganizationId})");
|
||||
await sutProvider.GetDependency<IInstallationDeviceRepository>()
|
||||
@ -380,7 +380,7 @@ public class NotificationHubPushNotificationServiceTests
|
||||
|
||||
await sutProvider.Sut.PushNotificationStatusAsync(notification, notificationStatus);
|
||||
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.SyncNotificationStatus,
|
||||
await AssertSendTemplateNotificationAsync(sutProvider, PushType.NotificationStatus,
|
||||
expectedNotification,
|
||||
$"(template:payload && organizationId:{notification.OrganizationId} && clientType:{clientType})");
|
||||
await sutProvider.GetDependency<IInstallationDeviceRepository>()
|
||||
|
@ -39,7 +39,7 @@ public class AzureQueuePushNotificationServiceTests
|
||||
|
||||
await sutProvider.GetDependency<QueueClient>().Received(1)
|
||||
.SendMessageAsync(Arg.Is<string>(message =>
|
||||
MatchMessage(PushType.SyncNotification, message,
|
||||
MatchMessage(PushType.Notification, message,
|
||||
new NotificationPushNotificationEquals(notification, null, installationId),
|
||||
deviceIdentifier.ToString())));
|
||||
}
|
||||
@ -61,7 +61,7 @@ public class AzureQueuePushNotificationServiceTests
|
||||
|
||||
await sutProvider.GetDependency<QueueClient>().Received(1)
|
||||
.SendMessageAsync(Arg.Is<string>(message =>
|
||||
MatchMessage(PushType.SyncNotification, message,
|
||||
MatchMessage(PushType.Notification, message,
|
||||
new NotificationPushNotificationEquals(notification, null, null),
|
||||
deviceIdentifier.ToString())));
|
||||
}
|
||||
@ -84,7 +84,7 @@ public class AzureQueuePushNotificationServiceTests
|
||||
|
||||
await sutProvider.GetDependency<QueueClient>().Received(1)
|
||||
.SendMessageAsync(Arg.Is<string>(message =>
|
||||
MatchMessage(PushType.SyncNotificationStatus, message,
|
||||
MatchMessage(PushType.NotificationStatus, message,
|
||||
new NotificationPushNotificationEquals(notification, notificationStatus, installationId),
|
||||
deviceIdentifier.ToString())));
|
||||
}
|
||||
@ -107,7 +107,7 @@ public class AzureQueuePushNotificationServiceTests
|
||||
|
||||
await sutProvider.GetDependency<QueueClient>().Received(1)
|
||||
.SendMessageAsync(Arg.Is<string>(message =>
|
||||
MatchMessage(PushType.SyncNotificationStatus, message,
|
||||
MatchMessage(PushType.NotificationStatus, message,
|
||||
new NotificationPushNotificationEquals(notification, notificationStatus, null),
|
||||
deviceIdentifier.ToString())));
|
||||
}
|
||||
|
Reference in New Issue
Block a user