4648
This commit is contained in:
@@ -31,101 +31,108 @@ namespace raven_integration
|
||||
|
||||
|
||||
|
||||
//NOTE: These tests are for Debug builds, they should still pass in a release build because none of the creds will work and it checks for 401 only
|
||||
//but a true test of these JWT tokens is only in server debug mode
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task JWTExpiredTokenShouldFail()
|
||||
{
|
||||
|
||||
ApiResponse a = await Util.GetAsync("build-mode", await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
var BuildMode = a.ObjectResponse["data"]["buildMode"].Value<string>();
|
||||
if (BuildMode == "DEBUG")
|
||||
{
|
||||
a = await Util.GetAsync("translation/list", 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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task JWTWrongIssuerShouldFail()
|
||||
{
|
||||
ApiResponse a = await Util.GetAsync("build-mode", await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
var BuildMode = a.ObjectResponse["data"]["buildMode"].Value<string>();
|
||||
if (BuildMode == "DEBUG")
|
||||
{
|
||||
a = await Util.GetAsync("translation/list", 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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task JWTNoAlgorithmShouldFail()
|
||||
{
|
||||
ApiResponse a = await Util.GetAsync("build-mode", await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
var BuildMode = a.ObjectResponse["data"]["buildMode"].Value<string>();
|
||||
if (BuildMode == "DEBUG")
|
||||
{
|
||||
a = await Util.GetAsync("translation/list", await Util.GetTokenAsync("INTEGRATION_TEST", "NO_ALGORITHM"));
|
||||
Util.ValidateHTTPStatusCode(a, 401);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task JWTBadSecretShouldFail()
|
||||
{
|
||||
ApiResponse a = await Util.GetAsync("build-mode", await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
var BuildMode = a.ObjectResponse["data"]["buildMode"].Value<string>();
|
||||
if (BuildMode == "DEBUG")
|
||||
{
|
||||
a = await Util.GetAsync("translation/list", await Util.GetTokenAsync("INTEGRATION_TEST", "WRONG_SECRET"));
|
||||
Util.ValidateHTTPStatusCode(a, 401);
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// case 4648 Removed all these jwt related tests for expediency
|
||||
/// they relied on an ancient setup in auth
|
||||
/// that no longer exists and I'm not sure how
|
||||
/// useful they are
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task JWTTruncatedSignatureShouldFail()
|
||||
{
|
||||
ApiResponse a = await Util.GetAsync("build-mode", await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
var BuildMode = a.ObjectResponse["data"]["buildMode"].Value<string>();
|
||||
if (BuildMode == "DEBUG")
|
||||
{
|
||||
a = await Util.GetAsync("translation/list", await Util.GetTokenAsync("INTEGRATION_TEST", "TRUNCATED_SIGNATURE"));
|
||||
Util.ValidateHTTPStatusCode(a, 401);
|
||||
}
|
||||
}
|
||||
// //NOTE: These tests are for Debug builds, they should still pass in a release build because none of the creds will work and it checks for 401 only
|
||||
// //but a true test of these JWT tokens is only in server debug mode
|
||||
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// [Fact]
|
||||
// public async Task JWTExpiredTokenShouldFail()
|
||||
// {
|
||||
|
||||
// ApiResponse a = await Util.GetAsync("build-mode", await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
// var BuildMode = a.ObjectResponse["data"]["buildMode"].Value<string>();
|
||||
// if (BuildMode == "DEBUG")
|
||||
// {
|
||||
// a = await Util.GetAsync("translation/list", 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);
|
||||
// }
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// [Fact]
|
||||
// public async Task JWTWrongIssuerShouldFail()
|
||||
// {
|
||||
// ApiResponse a = await Util.GetAsync("build-mode", await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
// var BuildMode = a.ObjectResponse["data"]["buildMode"].Value<string>();
|
||||
// if (BuildMode == "DEBUG")
|
||||
// {
|
||||
// a = await Util.GetAsync("translation/list", 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);
|
||||
// }
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// [Fact]
|
||||
// public async Task JWTNoAlgorithmShouldFail()
|
||||
// {
|
||||
// ApiResponse a = await Util.GetAsync("build-mode", await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
// var BuildMode = a.ObjectResponse["data"]["buildMode"].Value<string>();
|
||||
// if (BuildMode == "DEBUG")
|
||||
// {
|
||||
// a = await Util.GetAsync("translation/list", await Util.GetTokenAsync("INTEGRATION_TEST", "NO_ALGORITHM"));
|
||||
// Util.ValidateHTTPStatusCode(a, 401);
|
||||
// }
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// [Fact]
|
||||
// public async Task JWTBadSecretShouldFail()
|
||||
// {
|
||||
// ApiResponse a = await Util.GetAsync("build-mode", await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
// var BuildMode = a.ObjectResponse["data"]["buildMode"].Value<string>();
|
||||
// if (BuildMode == "DEBUG")
|
||||
// {
|
||||
// a = await Util.GetAsync("translation/list", await Util.GetTokenAsync("INTEGRATION_TEST", "WRONG_SECRET"));
|
||||
// Util.ValidateHTTPStatusCode(a, 401);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task JWTTransposedSignatureShouldFail()
|
||||
{
|
||||
ApiResponse a = await Util.GetAsync("build-mode", await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
var BuildMode = a.ObjectResponse["data"]["buildMode"].Value<string>();
|
||||
if (BuildMode == "DEBUG")
|
||||
{
|
||||
a = await Util.GetAsync("translation/list", await Util.GetTokenAsync("INTEGRATION_TEST", "TRANSPOSE_SIGNATURE"));
|
||||
Util.ValidateHTTPStatusCode(a, 401);
|
||||
}
|
||||
}
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// [Fact]
|
||||
// public async Task JWTTruncatedSignatureShouldFail()
|
||||
// {
|
||||
// ApiResponse a = await Util.GetAsync("build-mode", await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
// var BuildMode = a.ObjectResponse["data"]["buildMode"].Value<string>();
|
||||
// if (BuildMode == "DEBUG")
|
||||
// {
|
||||
// a = await Util.GetAsync("translation/list", await Util.GetTokenAsync("INTEGRATION_TEST", "TRUNCATED_SIGNATURE"));
|
||||
// Util.ValidateHTTPStatusCode(a, 401);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// [Fact]
|
||||
// public async Task JWTTransposedSignatureShouldFail()
|
||||
// {
|
||||
// ApiResponse a = await Util.GetAsync("build-mode", await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
// var BuildMode = a.ObjectResponse["data"]["buildMode"].Value<string>();
|
||||
// if (BuildMode == "DEBUG")
|
||||
// {
|
||||
// a = await Util.GetAsync("translation/list", await Util.GetTokenAsync("INTEGRATION_TEST", "TRANSPOSE_SIGNATURE"));
|
||||
// Util.ValidateHTTPStatusCode(a, 401);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user