private IOptions <AzureAdConfiguration> RegisterAzureSecrets(IntTestContext context) { var azureOptions = Options.Create(_configRoot.GetSection("AzureAd").Get <AzureAdConfiguration>()); context.Config.AzureAdConfiguration = azureOptions.Value; ConfigurationManager.VerifyConfigValuesSet(context.Config.AzureAdConfiguration); return(azureOptions); }
private NotifyConfiguration RegisterNotifySecrets(IntTestContext context) { var notifyOptions = Options.Create(_configRoot.GetSection("NotifyConfiguration").Get <NotifyConfiguration>()).Value; context.Config.NotifyConfiguration = notifyOptions; ConfigurationManager.VerifyConfigValuesSet(context.Config.NotifyConfiguration); return(notifyOptions); }
protected void InitCreateNotificationRequest(AddNotificationRequest request, IntTestContext intTestContext) { intTestContext.Uri = ApiUriFactory.NotificationEndpoints.CreateNewEmailNotification; intTestContext.HttpMethod = HttpMethod.Post; var body = RequestHelper.Serialise(request); intTestContext.HttpContent = new StringContent(body, Encoding.UTF8, "application/json"); }
private static void RegisterServer(IntTestContext context) { var webHostBuilder = WebHost.CreateDefaultBuilder() .UseKestrel(c => c.AddServerHeader = false) .UseEnvironment("Development") .UseStartup <Startup>(); context.Server = new TestServer(webHostBuilder); }
private void RegisterDatabaseSettings(IntTestContext context) { context.Config.DbConnection = Options.Create(_configRoot.GetSection("ConnectionStrings").Get <ConnectionStringsConfig>()).Value; ConfigurationManager.VerifyConfigValuesSet(context.Config.DbConnection); var dbContextOptionsBuilder = new DbContextOptionsBuilder <NotificationsApiDbContext>(); dbContextOptionsBuilder.EnableSensitiveDataLogging(); dbContextOptionsBuilder.UseSqlServer(context.Config.DbConnection.VhNotificationsApi); context.NotifyBookingsDbContextOptions = dbContextOptionsBuilder.Options; context.TestDataManager = new TestDataManager(context.NotifyBookingsDbContextOptions); }
public void RegisterSecrets(IntTestContext context) { var azureOptions = RegisterAzureSecrets(context); var notifyOptions = RegisterNotifySecrets(context); RegisterDefaultData(); RegisterHearingServices(context); RegisterDatabaseSettings(context); RegisterServer(context); RegisterApiSettings(context); GenerateBearerTokens(context, azureOptions, notifyOptions); }
private static void GenerateBearerTokens(IntTestContext context, IOptions <AzureAdConfiguration> azureOptions, NotifyConfiguration notifyConfiguration) { context.Tokens.NotificationApiBearerToken = new AzureTokenProvider(azureOptions).GetClientAccessToken( azureOptions.Value.ClientId, azureOptions.Value.ClientSecret, context.Config.ServicesConfig.VhNotificationApiResourceId); context.Tokens.NotificationApiBearerToken.Should().NotBeNullOrEmpty(); context.Tokens.NotificationCallbackBearerToken = new CustomJwtTokenProvider().GenerateTokenForCallbackEndpoint(notifyConfiguration.CallbackSecret, 60); context.Tokens.NotificationCallbackBearerToken.Should().NotBeNullOrWhiteSpace(); Zap.SetAuthToken(context.Tokens.NotificationApiBearerToken); }
public static void RemoveServer(IntTestContext context) { context.Server.Dispose(); }
private static void RegisterApiSettings(IntTestContext context) { context.Response = new HttpResponseMessage(); }
private void RegisterHearingServices(IntTestContext context) { context.Config.ServicesConfig = Options.Create(_configRoot.GetSection("Services").Get <ServicesConfiguration>()).Value; ConfigurationManager.VerifyConfigValuesSet(context.Config.ServicesConfig); }
public CreateNotificationsSteps(IntTestContext context) { _context = context; }
protected async Task <HttpResponseMessage> SendDeleteRequestAsync(IntTestContext intTestContext) { using var client = intTestContext.CreateClient(); return(await client.DeleteAsync(intTestContext.Uri)); }
protected async Task <HttpResponseMessage> SendPutRequestAsync(IntTestContext intTestContext) { using var client = intTestContext.CreateClient(); return(await client.PutAsync(intTestContext.Uri, intTestContext.HttpContent)); }
public static void RemoveNotificationTestData(IntTestContext context) { // Intentionally left empty }
public HearingReminderSteps(IntTestContext context) { _context = context; }
public CallbackSteps(IntTestContext context) { _context = context; }
public GetTemplateSteps(IntTestContext context) { _context = context; }
public CommonSteps(IntTestContext context) { _context = context; }
public HearingAmendmentSteps(IntTestContext context) { _context = context; }
public ConfigHooks(IntTestContext context) { _configRoot = ConfigurationManager.BuildConfig("4E35D845-27E7-4A19-BE78-CDA896BF907D"); context.Config = new Config(); context.Tokens = new NotificationApiTokens(); }
public HearingConfirmationSteps(IntTestContext context) { _context = context; }
public static async Task RemoveDataCreatedDuringTest(IntTestContext context) { await context.TestDataManager.RemoveNotifications(context.TestRun.NotificationsCreated.Select(x => x.Id)); }