[#21] Client: Allows multinenant client
Using one client for several owners Signed-off-by: Pavel Gross <p.gross@yando.com>
This commit is contained in:
parent
18126ea763
commit
2a28806ace
30 changed files with 349 additions and 281 deletions
|
@ -19,7 +19,7 @@ public abstract class ObjectTestsBase
|
|||
{
|
||||
protected static readonly string key = "KwHDAJ66o8FoLBjVbjP2sWBmgBMGjt7Vv4boA7xQrBoAYBE397Aq";
|
||||
|
||||
protected IOptions<ClientSettings> Settings { get; set; }
|
||||
protected IOptions<SingleOwnerClientSettings> Settings { get; set; }
|
||||
protected ContainerId ContainerId { get; set; }
|
||||
|
||||
protected NetworkMocker NetworkMocker { get; set; } = new NetworkMocker(key);
|
||||
|
@ -31,7 +31,7 @@ public abstract class ObjectTestsBase
|
|||
{
|
||||
var ecdsaKey = key.LoadWif();
|
||||
|
||||
Settings = Options.Create(new ClientSettings
|
||||
Settings = Options.Create(new SingleOwnerClientSettings
|
||||
{
|
||||
Key = key,
|
||||
Host = "http://localhost:8080"
|
||||
|
@ -71,14 +71,17 @@ public class ObjectTest : ObjectTestsBase
|
|||
public async void GetObjectTest()
|
||||
{
|
||||
var client = GetClient();
|
||||
var objectId = client.CalculateObjectId(Mocker.ObjectHeader!);
|
||||
|
||||
var context = new Context
|
||||
{
|
||||
Timeout = TimeSpan.FromSeconds(2)
|
||||
};
|
||||
var ecdsaKey = key.LoadWif();
|
||||
|
||||
var result = await client.GetObjectAsync(new PrmObjectGet(ContainerId, objectId) { Context = context });
|
||||
var ctx = new Context {
|
||||
Key = ecdsaKey,
|
||||
OwnerId = OwnerId.FromKey(ecdsaKey),
|
||||
Version = new ModelsV2.Version(2, 13) };
|
||||
|
||||
var objectId = client.CalculateObjectId(Mocker.ObjectHeader!, ctx);
|
||||
|
||||
var result = await client.GetObjectAsync(new PrmObjectGet(ContainerId, objectId) { Context = ctx });
|
||||
|
||||
Assert.NotNull(result);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue