-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #263 from Umplify/262-support-user-secrets-in-the-…
…test-fixture 262 support user secrets in the test fixture
- Loading branch information
Showing
11 changed files
with
130 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Auto Assign | ||
on: | ||
issues: | ||
types: [opened] | ||
pull_request: | ||
types: [opened] | ||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
issues: write | ||
pull-requests: write | ||
steps: | ||
- name: 'Auto-assign issue' | ||
uses: pozil/auto-assign-issue@v1 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
assignees: Arash-Sabet | ||
numOfAssignee: 1 |
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
7 changes: 7 additions & 0 deletions
7
examples/Xunit.Microsoft.DependencyInjection.ExampleTests/SecretValues.cs
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,7 @@ | ||
namespace Xunit.Microsoft.DependencyInjection.ExampleTests; | ||
|
||
public record SecretValues | ||
{ | ||
public string? Secret1 { get; set; } | ||
public string? Secret2 { get; set; } | ||
} |
23 changes: 23 additions & 0 deletions
23
examples/Xunit.Microsoft.DependencyInjection.ExampleTests/UserSecretTests.cs
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,23 @@ | ||
| ||
using Microsoft.Extensions.Options; | ||
|
||
namespace Xunit.Microsoft.DependencyInjection.ExampleTests; | ||
|
||
public class UserSecretTests(ITestOutputHelper testOutputHelper, TestProjectFixture fixture) : TestBed<TestProjectFixture>(testOutputHelper, fixture) | ||
{ | ||
[Fact] | ||
public void TestSecretValues() | ||
{ | ||
/* | ||
* TODO: Create a user secret entry like the following payload in user secrets and remove the same from appsettings.json file: | ||
* | ||
* "SecretValues": { | ||
* "Secret1": "secret1value", | ||
* "Secret2": "secret2value" | ||
* } | ||
*/ | ||
var secretValues = _fixture.GetService<IOptions<SecretValues>>(_testOutputHelper)!.Value; | ||
Assert.NotEmpty(secretValues?.Secret1 ?? string.Empty); | ||
Assert.NotEmpty(secretValues?.Secret1 ?? string.Empty); | ||
} | ||
} |
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
10 changes: 7 additions & 3 deletions
10
examples/Xunit.Microsoft.DependencyInjection.ExampleTests/appsettings.json
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 |
---|---|---|
@@ -1,5 +1,9 @@ | ||
{ | ||
"Options": { | ||
"Rate" : 10 | ||
} | ||
"Options": { | ||
"Rate": 10 | ||
}, | ||
"SecretValues": { | ||
"Secret1": "StoreSecret1InUserSecrets", | ||
"Secret2": "StoreSecret2InUserSecrets" | ||
} | ||
} |
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