-
Notifications
You must be signed in to change notification settings - Fork 22
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 #190 from nblumhardt/apikey-connect-as
Connect as a named user when creating the first API key
- Loading branch information
Showing
5 changed files
with
136 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
33 changes: 33 additions & 0 deletions
33
test/SeqCli.EndToEnd/ApiKey/ApiKeyDelegatePermissionsTestCase.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,33 @@ | ||
using System.Threading.Tasks; | ||
using Seq.Api; | ||
using SeqCli.EndToEnd.Support; | ||
using Serilog; | ||
using Xunit; | ||
|
||
namespace SeqCli.EndToEnd.ApiKey | ||
{ | ||
[CliTestCase(Multiuser = true)] | ||
public class ApiKeyDelegatePermissionsTestCase : ICliTestCase | ||
{ | ||
public Task ExecuteAsync(SeqConnection connection, ILogger logger, CliCommandRunner runner) | ||
{ | ||
var exit = runner.Exec( | ||
"user create", | ||
"-n carol -r \"Administrator\" -p test@1234 --no-password-change"); | ||
Assert.Equal(0, exit); | ||
|
||
exit = runner.Exec( | ||
"apikey create", | ||
"-t Setup --permissions=Setup,Write --connect-username=carol --connect-password=\"test@1234\""); | ||
Assert.Equal(0, exit); | ||
|
||
exit = runner.Exec("apikey list", "-t Setup --json --no-color"); | ||
Assert.Equal(0, exit); | ||
|
||
var output = runner.LastRunProcess.Output; | ||
Assert.Contains("\"AssignedPermissions\": [\"Setup\", \"Write\"]", output); | ||
|
||
return Task.CompletedTask; | ||
} | ||
} | ||
} |
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