[#3] Added generate proto script create container method
Signed-off-by: Ilyas Niyazov <i.niyazov@yadro.com>
This commit is contained in:
parent
19282f13cc
commit
297e107b10
52 changed files with 1380 additions and 74 deletions
15
tests/client/test_create_container.py
Normal file
15
tests/client/test_create_container.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
import pytest
|
||||
|
||||
from frostfs_sdk import FrostfsClient, ContainerCreateParam, ContainerId
|
||||
from frostfs_sdk.client.parameters.call_context_param import CallContextParam, TimeUnit
|
||||
from tests.helpers.models import Helpers
|
||||
|
||||
|
||||
@pytest.mark.container
|
||||
class TestContainer:
|
||||
def test_create_container(self, default_frostfs_client: FrostfsClient, helpers: Helpers):
|
||||
call_context = CallContextParam(timeout=1, time_unit=TimeUnit.MINUTES)
|
||||
req_body: ContainerCreateParam = helpers.container.create_params_container_create()
|
||||
|
||||
cid: ContainerId = default_frostfs_client.container.create_container(req_body, call_context)
|
||||
print(cid.value)
|
|
@ -1,8 +1,23 @@
|
|||
import pytest
|
||||
|
||||
from tests.helpers.models import ClientCryptograpy
|
||||
from frostfs_sdk import ClientSettings, FrostfsClient
|
||||
from tests.helpers.models import ClientCryptograpy, Helpers
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def client_cryptography():
|
||||
return ClientCryptograpy()
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def default_frostfs_client():
|
||||
client_settings = ClientSettings(
|
||||
wif="KxnEZ7FsPgKMdL9PYt9vsDkXiSw6qP9J8dpR4eVMsDpJyJxcYpve",
|
||||
address="localhost:8080"
|
||||
)
|
||||
return FrostfsClient(client_settings)
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def helpers():
|
||||
return Helpers()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from frostfs_api.cryptography.key_extension import KeyExtension
|
||||
from frostfs_api.cryptography.verifier import Verifier
|
||||
from frostfs_api.cryptography.signer import Signer
|
||||
from frostfs_sdk.cryptography.key_extension import KeyExtension
|
||||
from frostfs_sdk.cryptography.verifier import Verifier
|
||||
from frostfs_sdk.cryptography.signer import Signer
|
||||
from tests.helpers.params_container import ParamsContainerHelper
|
||||
|
||||
|
||||
class ClientCryptograpy:
|
||||
|
@ -8,3 +9,8 @@ class ClientCryptograpy:
|
|||
self.key_extension = KeyExtension()
|
||||
self.signer = Signer()
|
||||
self.verifier = Verifier()
|
||||
|
||||
|
||||
class Helpers:
|
||||
def __init__(self):
|
||||
self.container = ParamsContainerHelper()
|
||||
|
|
16
tests/helpers/params_container.py
Normal file
16
tests/helpers/params_container.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
from frostfs_sdk import ContainerCreateParam, WaitParam, Container, PlacementPolicy, Replica, BasicAcl
|
||||
|
||||
|
||||
class ParamsContainerHelper:
|
||||
def create_params_container_create(self):
|
||||
req_container_create = ContainerCreateParam(
|
||||
container=Container(
|
||||
placementPolicy=PlacementPolicy(
|
||||
replicas=[Replica(count=1)],
|
||||
unique=True,
|
||||
backup_factory=0
|
||||
)
|
||||
),
|
||||
wait_params=WaitParam()
|
||||
)
|
||||
return req_container_create
|
Loading…
Add table
Add a link
Reference in a new issue