Example #1
0
 public ConfigHooks(AcTestContext context)
 {
     _configRoot =
         ConfigurationManager.BuildConfig("4E35D845-27E7-4A19-BE78-CDA896BF907D", "fa265f5a-ee84-47a8-836c-4789584918e4");
     context.Config = new Config();
     context.Tokens = new NotificationApiTokens();
 }
Example #2
0
        private static void InitApiCallbackClient(AcTestContext context)
        {
            TestContext.Out.WriteLine("Initialising API Callback Client");
            var httpClient = new HttpClient();

            httpClient.DefaultRequestHeaders.Authorization =
                new AuthenticationHeaderValue("bearer", context.Tokens.NotificationCallbackBearerToken);
            var baseUrl = context.Config.ServicesConfig.NotificationApiUrl;

            context.ApiCallbackClient = NotificationApiClient.GetClient(baseUrl, httpClient);
        }
Example #3
0
 private void RegisterAzureSecrets(AcTestContext context)
 {
     TestContext.Out.WriteLine("Registering Azure secrets");
     context.Config.AzureAdConfiguration =
         Options.Create(_configRoot.GetSection("AzureAd").Get <AzureAdConfiguration>()).Value;
     context.Config.AzureAdConfiguration.Authority += context.Config.AzureAdConfiguration.TenantId;
     context.Config.AzureAdConfiguration.ClientId.Should().NotBeNullOrWhiteSpace();
     context.Config.AzureAdConfiguration.ClientSecret.Should().NotBeNullOrWhiteSpace();
     context.Config.AzureAdConfiguration.TenantId.Should().NotBeNullOrWhiteSpace();
     ConfigurationManager.VerifyConfigValuesSet(context.Config.AzureAdConfiguration);
     TestContext.Out.WriteLine("Registering Azure secrets complete");
 }
Example #4
0
        public async Task RegisterSecrets(AcTestContext context)
        {
            await TestContext.Out.WriteLineAsync("Registering secrets");

            RegisterAzureSecrets(context);
            RegisterHearingServices(context);
            await GenerateBearerTokens(context);

            InitApiClient(context);
            InitApiCallbackClient(context);
            await TestContext.Out.WriteLineAsync("Registering secrets complete");
        }
Example #5
0
        private void RegisterHearingServices(AcTestContext context)
        {
            TestContext.Out.WriteLine("Registering hearing services");
            context.Config.ServicesConfig = GetTargetTestEnvironment() == string.Empty ? Options.Create(_configRoot.GetSection("Services").Get <ServicesConfiguration>()).Value :
                                            Options.Create(_configRoot.GetSection($"Testing.{GetTargetTestEnvironment()}.Services").Get <ServicesConfiguration>()).Value;
            if (context.Config.ServicesConfig == null && GetTargetTestEnvironment() != string.Empty)
            {
                throw new TestSecretsFileMissingException(GetTargetTestEnvironment());
            }
            ConfigurationManager.VerifyConfigValuesSet(context.Config.ServicesConfig);

            context.Config.NotifyConfiguration = GetTargetTestEnvironment() == string.Empty ? Options.Create(_configRoot.GetSection("NotifyConfiguration").Get <NotifyConfiguration>()).Value
                    : Options.Create(_configRoot.GetSection($"Testing.{GetTargetTestEnvironment()}.NotifyConfiguration").Get <NotifyConfiguration>()).Value;
            if (context.Config.NotifyConfiguration == null && GetTargetTestEnvironment() != string.Empty)
            {
                throw new TestSecretsFileMissingException(GetTargetTestEnvironment());
            }
            ConfigurationManager.VerifyConfigValuesSet(context.Config.NotifyConfiguration);
            TestContext.Out.WriteLine("Registering hearing services complete");
        }
Example #6
0
        private static async Task GenerateBearerTokens(AcTestContext context)
        {
            await TestContext.Out.WriteLineAsync("Generating bearer tokens");

            var azureConfig = new AzureAdConfig()
            {
                Authority    = context.Config.AzureAdConfiguration.Authority,
                ClientId     = context.Config.AzureAdConfiguration.ClientId,
                ClientSecret = context.Config.AzureAdConfiguration.ClientSecret,
                TenantId     = context.Config.AzureAdConfiguration.TenantId
            };

            context.Tokens.NotificationApiBearerToken = await ConfigurationManager.GetBearerToken(
                azureConfig, context.Config.ServicesConfig.VhNotificationApiResourceId);

            context.Tokens.NotificationApiBearerToken.Should().NotBeNullOrEmpty("Bearer token for api must be set");

            context.Tokens.NotificationCallbackBearerToken =
                new CustomJwtTokenProvider().GenerateTokenForCallbackEndpoint(
                    context.Config.NotifyConfiguration.CallbackSecret, 60);
            context.Tokens.NotificationCallbackBearerToken.Should()
            .NotBeNullOrWhiteSpace("Bearer token for callback must be set");
        }
 public HearingAmendmentSteps(AcTestContext context)
 {
     _context = context;
 }
 public HearingReminderSteps(AcTestContext context)
 {
     _context = context;
 }
Example #9
0
 public CallbackSteps(AcTestContext context)
 {
     _context = context;
     _createNotificationSteps = new CreateNotificationSteps(context);
     _commonSteps             = new CommonSteps(context);
 }
 public HearingConfirmationSteps(AcTestContext context)
 {
     _context = context;
 }
Example #11
0
 public GetTemplateSteps(AcTestContext context)
 {
     _context = context;
 }
Example #12
0
 public CreateNotificationSteps(AcTestContext context)
 {
     _context = context;
 }
 public CommonSteps(AcTestContext acTestContext)
 {
     _context = acTestContext;
 }
Example #14
0
 public HealthCheckSteps(AcTestContext context)
 {
     _context = context;
 }