From ebdf135e647b8c98bd36ecccf8e15c2bf60f41e8 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 18 Jan 2019 20:57:57 +0000 Subject: [PATCH] --- Authentication/Auth.cs | 55 +++++++++++++++++++++++++++++++++--------- util.cs | 4 +-- 2 files changed, 45 insertions(+), 14 deletions(-) diff --git a/Authentication/Auth.cs b/Authentication/Auth.cs index 7d39fe3..9709413 100644 --- a/Authentication/Auth.cs +++ b/Authentication/Auth.cs @@ -40,8 +40,14 @@ namespace raven_integration [Fact] public async void JWTExpiredTokenShouldFail() { - ApiResponse a = await Util.GetAsync("Locale/picklist", await Util.GetTokenAsync("INTEGRATION_TEST", "EXPIRED"));//lowest level test user because there are no limits on this route except to be authenticated - Util.ValidateHTTPStatusCode(a, 401); + + ApiResponse a = await Util.GetAsync("BuildMode"); + var BuildMode = a.ObjectResponse["data"]["buildMode"].Value(); + if (BuildMode == "DEBUG") + { + a = await Util.GetAsync("Locale/picklist", await Util.GetTokenAsync("INTEGRATION_TEST", "EXPIRED"));//lowest level test user because there are no limits on this route except to be authenticated + Util.ValidateHTTPStatusCode(a, 401); + } } /// @@ -50,8 +56,13 @@ namespace raven_integration [Fact] public async void JWTWrongIssuerShouldFail() { - ApiResponse a = await Util.GetAsync("Locale/picklist", await Util.GetTokenAsync("INTEGRATION_TEST", "WRONG_ISSUER"));//lowest level test user because there are no limits on this route except to be authenticated - Util.ValidateHTTPStatusCode(a, 401); + ApiResponse a = await Util.GetAsync("BuildMode"); + var BuildMode = a.ObjectResponse["data"]["buildMode"].Value(); + if (BuildMode == "DEBUG") + { + a = await Util.GetAsync("Locale/picklist", await Util.GetTokenAsync("INTEGRATION_TEST", "WRONG_ISSUER"));//lowest level test user because there are no limits on this route except to be authenticated + Util.ValidateHTTPStatusCode(a, 401); + } } /// @@ -60,8 +71,13 @@ namespace raven_integration [Fact] public async void JWTNoAlgorithmShouldFail() { - ApiResponse a = await Util.GetAsync("Locale/picklist", await Util.GetTokenAsync("INTEGRATION_TEST", "NO_ALGORITHM")); - Util.ValidateHTTPStatusCode(a, 401); + ApiResponse a = await Util.GetAsync("BuildMode"); + var BuildMode = a.ObjectResponse["data"]["buildMode"].Value(); + if (BuildMode == "DEBUG") + { + a = await Util.GetAsync("Locale/picklist", await Util.GetTokenAsync("INTEGRATION_TEST", "NO_ALGORITHM")); + Util.ValidateHTTPStatusCode(a, 401); + } } /// @@ -70,8 +86,13 @@ namespace raven_integration [Fact] public async void JWTBadSecretShouldFail() { - ApiResponse a = await Util.GetAsync("Locale/picklist", await Util.GetTokenAsync("INTEGRATION_TEST", "WRONG_SECRET")); - Util.ValidateHTTPStatusCode(a, 401); + ApiResponse a = await Util.GetAsync("BuildMode"); + var BuildMode = a.ObjectResponse["data"]["buildMode"].Value(); + if (BuildMode == "DEBUG") + { + a = await Util.GetAsync("Locale/picklist", await Util.GetTokenAsync("INTEGRATION_TEST", "WRONG_SECRET")); + Util.ValidateHTTPStatusCode(a, 401); + } } @@ -81,8 +102,13 @@ namespace raven_integration [Fact] public async void JWTTruncatedSignatureShouldFail() { - ApiResponse a = await Util.GetAsync("Locale/picklist", await Util.GetTokenAsync("INTEGRATION_TEST", "TRUNCATED_SIGNATURE")); - Util.ValidateHTTPStatusCode(a, 401); + ApiResponse a = await Util.GetAsync("BuildMode"); + var BuildMode = a.ObjectResponse["data"]["buildMode"].Value(); + if (BuildMode == "DEBUG") + { + a = await Util.GetAsync("Locale/picklist", await Util.GetTokenAsync("INTEGRATION_TEST", "TRUNCATED_SIGNATURE")); + Util.ValidateHTTPStatusCode(a, 401); + } } @@ -92,8 +118,13 @@ namespace raven_integration [Fact] public async void JWTTransposedSignatureShouldFail() { - ApiResponse a = await Util.GetAsync("Locale/picklist", await Util.GetTokenAsync("INTEGRATION_TEST", "TRANSPOSE_SIGNATURE")); - Util.ValidateHTTPStatusCode(a, 401); + ApiResponse a = await Util.GetAsync("BuildMode"); + var BuildMode = a.ObjectResponse["data"]["buildMode"].Value(); + if (BuildMode == "DEBUG") + { + a = await Util.GetAsync("Locale/picklist", await Util.GetTokenAsync("INTEGRATION_TEST", "TRANSPOSE_SIGNATURE")); + Util.ValidateHTTPStatusCode(a, 401); + } } diff --git a/util.cs b/util.cs index 08f0d3c..a96d136 100644 --- a/util.cs +++ b/util.cs @@ -24,8 +24,8 @@ namespace raven_integration private static HttpClient client { get; } = new HttpClient(); - private static string API_BASE_URL = "http://localhost:7575/api/v8.0/"; - //private static string API_BASE_URL = "https://test.helloayanova.com/api/v8.0/"; + // public static string API_BASE_URL = "http://localhost:7575/api/v8.0/"; + public static string API_BASE_URL = "https://test.helloayanova.com/api/v8.0/"; public static string TEST_DATA_FOLDER = @"..\..\..\testdata\";