genlayer-test 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: genlayer-test
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: GenLayer Testing Suite
5
5
  Author: GenLayer
6
6
  License-Expression: MIT
@@ -16,7 +16,7 @@ Requires-Python: >=3.8
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
18
  Requires-Dist: pytest
19
- Requires-Dist: genlayer-py==0.1.0
19
+ Requires-Dist: genlayer-py==0.3.0
20
20
  Dynamic: license-file
21
21
 
22
22
  # GenLayer Testing Suite
@@ -1,6 +1,6 @@
1
- genlayer_test-0.1.1.dist-info/licenses/LICENSE,sha256=che_H4vE0QUx3HvWrAa1_jDEVInift0U6VO15-QqEls,1064
1
+ genlayer_test-0.1.2.dist-info/licenses/LICENSE,sha256=che_H4vE0QUx3HvWrAa1_jDEVInift0U6VO15-QqEls,1064
2
2
  gltest/__init__.py,sha256=AK_YfRvwlhrOheOelUG8qIRG17on0-nFCF747dopg2w,332
3
- gltest/assertions.py,sha256=O9pHt9aOxMVYk_C2fF2-qzT_xYMaK0YigR3HXeejmaU,590
3
+ gltest/assertions.py,sha256=dBjiK5-LuxrrktkNDP7n-t6i43UNCL_cq7M4BLqRyFk,678
4
4
  gltest/exceptions.py,sha256=deJPmrTe5gF33qkkKF2IVJY7lc_knI7Ql3N7jZ8aLZs,510
5
5
  gltest/plugin_config.py,sha256=8Z97RtEJ89OcRbki_oRuBBVct_q56BFmKvthan1y9Y4,840
6
6
  gltest/plugin_hooks.py,sha256=py1rzIR9QSsFOt8SEePPL96e-8DeiPFxvcPZurRlExM,1436
@@ -17,6 +17,7 @@ gltest/helpers/take_snapshot.py,sha256=eXqEKXM2hcox3pLGIcNddobU8zXPQvD-Iwf87eHqW
17
17
  gltest_cli/main.py,sha256=Ti2-0Ev1x5_cM0D1UKqdgaDt80CDHEQGtdRne2qLm4M,53
18
18
  tests/artifact/test_contract_definition.py,sha256=8X829MsNfEObtIMmotk6nRVLDEp5KfJE6zrAK4IPfCc,3323
19
19
  tests/artifact/contracts/not_ic_contract.py,sha256=hQyGnYiiVceYdLI2WrvcFgPqzy1S4-YMb9FPhiHEGSA,510
20
+ tests/assertions/test_assertions.py,sha256=y1XE15908Rv3RjWNxU7DtRF2gEGM9eEiHPh9jJHbR4g,1046
20
21
  tests/examples/contracts/football_prediction_market.py,sha256=kdouFijjeCdIJyaVJlgXcqbBAXecA9_YdhklSsIW-QM,3219
21
22
  tests/examples/contracts/intelligent_oracle.py,sha256=WrNZWWoi1sz22Azt2EXgdWHDg5Ihca2pWUHrM9pVfQE,12319
22
23
  tests/examples/contracts/intelligent_oracle_factory.py,sha256=ax496IZuDCA728rRcbjwTaM4Q4E-Y1jGkHsEcyf1cig,1490
@@ -45,8 +46,8 @@ tests/examples/tests/test_user_storage.py,sha256=QEgt2p22LAyzBnBb0YW4BWa_Jasrt15
45
46
  tests/examples/tests/test_wizard_of_coin.py,sha256=aUDeV5w0XONMMS71Vzw80lHfcSM0z8RKPJSXAuDwRto,392
46
47
  tests/plugin/conftest.py,sha256=RKdoE5_zcMimeojAoA_GSFI9du4pMzMi1vZ1njtfoAs,28
47
48
  tests/plugin/test_plugin_hooks.py,sha256=FQOrkhoXLinq0sjvoYjr63Oqg-ZVPcNFeUrK4bqrn4E,2020
48
- genlayer_test-0.1.1.dist-info/METADATA,sha256=SLlBr5OZZWmgBKAfkz889L-k7mMYX92PFyiCjK67oVQ,13471
49
- genlayer_test-0.1.1.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
50
- genlayer_test-0.1.1.dist-info/entry_points.txt,sha256=rXhrPVq2IhVsd4uWzxzwCTx7jA1KcQIVNxDCUuxq4f8,89
51
- genlayer_test-0.1.1.dist-info/top_level.txt,sha256=-qiGZxTRBytujzgVcKpxjvQ-WNeUDjXa59ceGMwMpko,24
52
- genlayer_test-0.1.1.dist-info/RECORD,,
49
+ genlayer_test-0.1.2.dist-info/METADATA,sha256=05aK4xzg2NrGQIAcFkWS6NNzvFyxVkF_jCqSZhgk8po,13471
50
+ genlayer_test-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
51
+ genlayer_test-0.1.2.dist-info/entry_points.txt,sha256=rXhrPVq2IhVsd4uWzxzwCTx7jA1KcQIVNxDCUuxq4f8,89
52
+ genlayer_test-0.1.2.dist-info/top_level.txt,sha256=-qiGZxTRBytujzgVcKpxjvQ-WNeUDjXa59ceGMwMpko,24
53
+ genlayer_test-0.1.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.8.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
gltest/assertions.py CHANGED
@@ -6,9 +6,11 @@ def tx_execution_succeeded(result: GenLayerTransaction) -> bool:
6
6
  return False
7
7
  if "leader_receipt" not in result["consensus_data"]:
8
8
  return False
9
- if "execution_result" not in result["consensus_data"]["leader_receipt"]:
9
+ if len(result["consensus_data"]["leader_receipt"]) == 0:
10
10
  return False
11
- execution_result = result["consensus_data"]["leader_receipt"]["execution_result"]
11
+ if "execution_result" not in result["consensus_data"]["leader_receipt"][0]:
12
+ return False
13
+ execution_result = result["consensus_data"]["leader_receipt"][0]["execution_result"]
12
14
  return execution_result == "SUCCESS"
13
15
 
14
16
 
@@ -0,0 +1,31 @@
1
+ from gltest.assertions import tx_execution_succeeded, tx_execution_failed
2
+
3
+ GENLAYER_SUCCESS_TRANSACTION = {
4
+ "consensus_data": {"leader_receipt": [{"execution_result": "SUCCESS"}]}
5
+ }
6
+
7
+ GENLAYER_FAILED_TRANSACTION = {
8
+ "consensus_data": {"leader_receipt": [{"execution_result": "ERROR"}]}
9
+ }
10
+
11
+ GENLAYER_EMPTY_LEADER_RECEIPT = {"consensus_data": {"leader_receipt": []}}
12
+
13
+
14
+ def test_with_successful_transaction():
15
+ assert tx_execution_succeeded(GENLAYER_SUCCESS_TRANSACTION) is True
16
+ assert tx_execution_failed(GENLAYER_SUCCESS_TRANSACTION) is False
17
+
18
+
19
+ def test_with_failed_transaction():
20
+ assert tx_execution_succeeded(GENLAYER_FAILED_TRANSACTION) is False
21
+ assert tx_execution_failed(GENLAYER_FAILED_TRANSACTION) is True
22
+
23
+
24
+ def test_with_empty_leader_receipt():
25
+ assert tx_execution_succeeded(GENLAYER_EMPTY_LEADER_RECEIPT) is False
26
+ assert tx_execution_failed(GENLAYER_EMPTY_LEADER_RECEIPT) is True
27
+
28
+
29
+ def test_with_invalid_transaction():
30
+ assert tx_execution_succeeded({}) is False
31
+ assert tx_execution_failed({}) is True