import pytest from frostfs_api.crypto.key_extension import KeyExtension from tests.helpers.convert import convert_bytes_format_127_to_256 from tests.helpers.resources import WIF, PRIVATE_KEY @pytest.mark.crypto class TestKeyExtension: def test_get_private_key_from_wif_success(self, client_key_extension: KeyExtension): private_key = client_key_extension.get_private_key_from_wif(WIF) assert len(private_key) == 32, f"Not correct len of private key, expected: 32 Actual: {len(private_key)} " assert private_key == bytes(convert_bytes_format_127_to_256(PRIVATE_KEY)), \ f"Not match private key, Expected: {PRIVATE_KEY}, Actual: {private_key}" def test_get_private_key_empty_wif(self, client_key_extension: KeyExtension): with pytest.raises(ValueError, match="Empty WIF private"): client_key_extension.get_private_key_from_wif("") def test_get_private_key_incorrect_wif(self, client_key_extension: KeyExtension): with pytest.raises(ValueError, match="Invalid checksum"): client_key_extension.get_private_key_from_wif("AAAAAAABBBBBBBBBBBCCCCCCCDDDDDDDDDDDDDDDDD")