Skip to content

Commit

Permalink
[test] add more allure annotations and fix problem with types
Browse files Browse the repository at this point in the history
Signed-off-by: alexstroke <111361420+astrokov7@users.noreply.github.com>
  • Loading branch information
AlexStroke authored and SamHSmith committed May 16, 2024
1 parent 2cf48f8 commit 951d6a3
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion how_to_test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
maturin build
poetry add target/wheels/iroha-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
poetry install
poetry run python -m pytest tests
poetry run python -m pytest tests --alluredir allure-results
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ authors = ["Aleksandr Strokov <busyfifer@gmail.com>"]

[tool.poetry.dependencies]
python = "^3.9.6"
allure-python-commons = "*"
pytest = "^8.1.1"
faker = "^24.4.0"
allure-pytest = "^2.13.5"
#iroha = {path = "target/wheels/iroha-0.1.0-cp39-cp39-macosx_11_0_arm64.whl"}
iroha = {path = "target/wheels/iroha-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl"}
#iroha = {path = "target/wheels/iroha-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl"}
10 changes: 8 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
from tests import client, fake
from tests.helpers import generate_public_key

@pytest.fixture(scope="function", autouse=True)
def before_each():
"""Fixture to set up and reset the client_cli state."""
allure.dynamic.label("sdk", "Python 3")
allure.dynamic.label("owner", "astrokov")

# Fixtures for Generating New Identifiers
@pytest.fixture()
def GIVEN_new_domain_id():
Expand Down Expand Up @@ -70,7 +76,7 @@ def GIVEN_registered_account(GIVEN_new_account_id):
[iroha.Instruction
.register_account(
GIVEN_new_account_id,
[generate_public_key(seed="abcd1122")])]))
generate_public_key(seed="abcd1122"))]))
time.sleep(2)
return GIVEN_new_account_id

Expand All @@ -85,7 +91,7 @@ def GIVEN_registered_domain_with_registered_accounts(
[iroha.Instruction
.register_account(
GIVEN_new_account_id,
[generate_public_key(seed="abcd1122")])]))
generate_public_key(seed="abcd1122"))]))
time.sleep(2)
return GIVEN_registered_domain

Expand Down
2 changes: 2 additions & 0 deletions tests/query/test_query_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def story_account_queries_accounts():
allure.dynamic.label("permission", "no_permission_required")


@allure.id("2378")
@allure.label("sdk_test_id", "query_all_accounts")
def test_query_all_accounts():
with allure.step('WHEN client queries all accounts'):
Expand All @@ -18,6 +19,7 @@ def test_query_all_accounts():
assert len(all_accounts) > 0, "No accounts found in the system"


@allure.id("2378")
@allure.label("sdk_test_id", "query_all_accounts_in_domain")
def test_query_all_accounts_in_domain(
GIVEN_registered_domain_with_registered_accounts):
Expand Down
2 changes: 2 additions & 0 deletions tests/query/test_query_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def story_account_queries_accounts():
allure.dynamic.label("permission", "no_permission_required")


@allure.id("2381")
@allure.label("sdk_test_id", "query_all_accounts")
def test_query_all_accounts():
with allure.step('WHEN client queries all accounts'):
Expand All @@ -18,6 +19,7 @@ def test_query_all_accounts():
assert len(all_accounts) > 0, "No accounts found in the system"


@allure.id("2380")
@allure.label("sdk_test_id", "query_all_accounts_in_domain")
def test_query_all_accounts_in_domain(
GIVEN_registered_domain_with_registered_accounts):
Expand Down
1 change: 1 addition & 0 deletions tests/query/test_query_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def story_account_queries_domains():
allure.dynamic.story("Account queries domains")
allure.dynamic.label("permission", "no_permission_required")

@allure.id("2385")
@allure.label("sdk_test_id", "query_all_domains")
def test_query_all_domains():
with allure.step('WHEN client queries all domains'):
Expand Down
3 changes: 2 additions & 1 deletion tests/transaction/test_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def story_account_register_account():
allure.dynamic.story("Account registers an account")
allure.dynamic.label("permission", "no_permission_required")

@allure.id("2384")
@allure.label("sdk_test_id", "register_account")
def test_register_account(
GIVEN_new_account_id):
Expand All @@ -20,7 +21,7 @@ def test_register_account(
[iroha.Instruction
.register_account(
GIVEN_new_account_id,
[generate_public_key(seed="abcd1122")])]))
generate_public_key(seed="abcd1122"))]))
time.sleep(3)
with allure.step(
f'THEN Iroha should have the "{GIVEN_new_account_id}" account'):
Expand Down
5 changes: 3 additions & 2 deletions tests/transaction/test_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def story_account_register_asset():
allure.dynamic.story("Account registers an asset")
allure.dynamic.label("permission", "no_permission_required")

@allure.id("2383")
def test_register_asset_definition(
GIVEN_new_asset_definition_id):
with allure.step(
Expand All @@ -27,6 +28,7 @@ def test_register_asset_definition(
f'THEN Iroha should have the "{GIVEN_new_asset_definition_id}" account'):
assert GIVEN_new_asset_definition_id in client.query_all_asset_definitions()

@allure.id("2379")
def test_mint_asset(
GIVEN_registered_asset_definition,
GIVEN_registered_account):
Expand All @@ -37,8 +39,7 @@ def test_mint_asset(
[iroha.Instruction
.mint_asset(
5,
asset,
iroha.AssetValueType.numeric_fractional(0))]))
asset)]))
time.sleep(3)
with allure.step(
f'THEN Iroha should have the new asset "{asset}"'):
Expand Down
1 change: 1 addition & 0 deletions tests/transaction/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def story_account_registers_domain():
allure.dynamic.story("Account registers a domain")
allure.dynamic.label("permission", "no_permission_required")

@allure.id("2382")
@allure.label("sdk_test_id", "register_domain")
def test_register_domain(
GIVEN_new_domain_id):
Expand Down

0 comments on commit 951d6a3

Please sign in to comment.