-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: alexstroke <[email protected]>
- Loading branch information
1 parent
38fc064
commit 5a182ec
Showing
4 changed files
with
39 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,26 @@ | ||
import allure | ||
import pytest | ||
|
||
from src.client_cli import client_cli, iroha | ||
import json | ||
from src.client_cli import client_cli, iroha, have | ||
|
||
@pytest.fixture(scope="function", autouse=True) | ||
def story_account_transfers_domain(): | ||
allure.dynamic.story('Account transfers a domain') | ||
allure.dynamic.label('permission', 'no_permission_required') | ||
|
||
@allure.label('sdk_test_id', 'transfer_domain_successfully') | ||
def test_transfer_domain_successfully( | ||
GIVEN_currently_authorized_account, | ||
GIVEN_new_one_existing_account, | ||
GIVEN_new_one_existing_domain, | ||
def test_transfer_domain( | ||
GIVEN_currently_authorized_account, | ||
GIVEN_new_one_existing_account, | ||
GIVEN_new_one_existing_domain, | ||
): | ||
with allure.step( | ||
f'WHEN client_cli transfers this domain from {GIVEN_currently_authorized_account} to {GIVEN_new_one_existing_account}'): | ||
client_cli.execute(f'domain transfer --from={GIVEN_currently_authorized_account} --to={GIVEN_new_one_existing_account} --id={GIVEN_new_one_existing_domain.name}') | ||
f'WHEN {GIVEN_currently_authorized_account} transfers domains ' | ||
f'to {GIVEN_new_one_existing_account}'): | ||
client_cli.execute(f'domain transfer ' | ||
f'--from={GIVEN_currently_authorized_account} ' | ||
f'--to={GIVEN_new_one_existing_account} ' | ||
f'--id={GIVEN_new_one_existing_domain.name}') | ||
with allure.step( | ||
f'THEN {GIVEN_new_one_existing_account} should own this domain {GIVEN_new_one_existing_domain}'): | ||
def condition(): | ||
owned_by = GIVEN_new_one_existing_account | ||
domain_name = GIVEN_new_one_existing_domain.name | ||
with allure.step( | ||
f'WHEN client_cli query domains filtered by name "{domain_name}"'): | ||
domains = iroha.list_filter(f'{{"Identifiable": {{"Is": "{domain_name}"}}}}').domains() | ||
with allure.step( | ||
f'THEN Iroha should return only return domains with "{domain_name}" name'): | ||
allure.attach( | ||
json.dumps(domains), | ||
name='domains', | ||
attachment_type=allure.attachment_type.JSON) | ||
return len(domains) != 0 and all(domains[key]["id"] == domain_name and domains[key]["owned_by"] == owned_by for key in domains) | ||
client_cli.wait_for(condition) | ||
f'THEN {GIVEN_new_one_existing_account} should own {GIVEN_new_one_existing_domain}'): | ||
iroha.should(have.domain(GIVEN_new_one_existing_domain.name, owned_by=GIVEN_new_one_existing_account)) |