-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix 'innerhandler is null' in refreshTokenHandler + add test in .NET …
…Core 2.2
- Loading branch information
Tim Stuyckens
committed
Jan 25, 2019
1 parent
acadda4
commit a8c13e1
Showing
8 changed files
with
131 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using System; | ||
using Microsoft.Extensions.Configuration; | ||
using Viren.Execution; | ||
using Xunit; | ||
|
||
namespace Viren.Tests | ||
{ | ||
public class TestSettings | ||
{ | ||
public string apiHostName { get; set; } | ||
public string auth0Domain { get; set; } | ||
public string auth0TestsClientId { get; set; } | ||
public string auth0TestsClientSecret { get; set; } | ||
|
||
public override string ToString() | ||
{ | ||
return $"{apiHostName} {auth0Domain} {auth0TestsClientId} {auth0TestsClientSecret}"; | ||
} | ||
} | ||
|
||
public class SimpleTestCall | ||
{ | ||
|
||
private TestSettings _testSettings; | ||
|
||
public SimpleTestCall() | ||
{ | ||
//https://xunit.github.io/docs/comparisons | ||
// We believe that use of [SetUp] is generally bad. However, you can implement a parameterless constructor as a direct replacement. See Note 2 | ||
|
||
var config=new ConfigurationBuilder() | ||
.AddJsonFile("appsettings.json", optional: true) | ||
.Build(); | ||
|
||
_testSettings = new TestSettings(); | ||
|
||
config | ||
.GetSection("AppSettings") | ||
.Bind(_testSettings); | ||
} | ||
|
||
[Fact] | ||
public async void ModelGetVersion() | ||
{ | ||
Console.WriteLine(_testSettings); | ||
var apiHostName = _testSettings.apiHostName; // "http://dev.calc-exec.be/" ; | ||
|
||
var auth0Domain = _testSettings.auth0Domain;// "https://teal-calculation-dev.eu.auth0.com"; | ||
var auth0TestsClientId= _testSettings.auth0TestsClientId; // "Hekmz983EKNcZTh5kETQqChZtUnuDXwe"; | ||
var auth0TestsClientSecret = _testSettings.auth0TestsClientSecret; // "9TPXNqylBXydE2H20QFxQc6lGy6MShk9nAxsr8LwH6E-klpLyNzPgoRcrPGSRGm5"; | ||
|
||
|
||
var httpClient = VirenHttpClientFactory.Create(auth0TestsClientId, auth0TestsClientSecret, apiHostName,auth0Domain); | ||
var client = new ExecutionClient(httpClient); | ||
|
||
try | ||
{ | ||
var version = await client.Model.GetVersion("TestProject", "TestModel",false); | ||
Assert.NotNull(version); | ||
} | ||
catch (Exception e) when (e.Message.Contains("you don't have enough rights you need to have")) | ||
{ | ||
Assert.True(true); //rechten issue, maar API call is gelukt | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.2</TargetFramework> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.2.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" /> | ||
<PackageReference Include="xunit" Version="2.4.0" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Viren.Core\Viren.Core.csproj" /> | ||
<ProjectReference Include="..\Viren.Execution\Viren.Execution.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="Microsoft.Extensions.Configuration, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60"> | ||
<HintPath>..\..\..\..\Users\Tim\.nuget\packages\microsoft.extensions.configuration\2.2.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="appsettings.json"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Debug", | ||
"System": "Information", | ||
"Microsoft": "Information" | ||
} | ||
}, | ||
"AppSettings": { | ||
"apiHostName": "https://teal-calculation-execution-develop.azurewebsites.net/", | ||
"auth0Domain": "https://teal-calculation-test.eu.auth0.com", | ||
"auth0TestsClientId": "NWEkzBg4OBSzbEWya3avWCs2QP3S3M6D", | ||
"auth0TestsClientSecret": "8C_7ej-Ca22qGkLGVYdw92ENZjKKD9IgcS-Vl0tB2OtuCvFBlgW4SeiMqNlwdBbq" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters