Esempio n. 1
0
 public static GivenStatement NewApiKey(this GivenStatement givenStatement,
                                        TestUserApiKeyJsonEntity apiKey, string testKey = null)
 {
     givenStatement.GetStatementLogger()
     .Information($"[{{ContextStatement}}] Saving api keys {apiKey}", givenStatement.GetType().Name);
     givenStatement.AddData(apiKey, BddKeyConstants.NewApiKey + testKey);
     return(givenStatement);
 }
Esempio n. 2
0
        public HttpResponseMessage PostApiKeys(string tokenValue, TestUserApiKeyJsonEntity apiKeys)
        {
            using (HttpClient client = HttpClientFactory.Create())
            {
                client.DefaultRequestHeaders
                .Accept
                .Add(new MediaTypeWithQualityHeaderValue(CommonHttpConstants.ApplicationJsonMedia));

                if (tokenValue != null)
                {
                    client.DefaultRequestHeaders.Authorization =
                        new AuthenticationHeaderValue(CommonHttpConstants.AuthorizationHeader, tokenValue);
                }

                return(client.LogAndPost($"{BaseApiRoute}/{PostApiKeysRoute}",
                                         new StringContent(apiKeys.ToString(), Encoding.UTF8, CommonHttpConstants.ApplicationJsonMedia),
                                         Logger));
            }
        }