-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
40 additions
and
61 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
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,25 @@ | ||
""" | ||
Verify the sanity of fixture .json format | ||
""" | ||
"""Verify the sanity of fixture .json format.""" | ||
|
||
from pydantic import ValidationError | ||
|
||
from .schemas.blockchain.test import BlockchainTestFixtureModel | ||
|
||
|
||
class VerifyFixtureJson: | ||
""" | ||
Class to verify the correctness of a fixture JSON. | ||
""" | ||
"""Class to verify the correctness of a fixture JSON.""" | ||
|
||
def __init__(self, name: str, fixture_json: dict): | ||
"""Verify generated fixture .json file format.""" | ||
self.fixture_json = fixture_json | ||
self.fixture_name = name | ||
if self.fixture_json.get("network") and not self.fixture_json.get("engineNewPayloads"): | ||
self.verify_blockchain_fixture_json() | ||
|
||
def verify_blockchain_fixture_json(self): | ||
""" | ||
Function to verify blockchain json fixture | ||
""" | ||
"""Verify blockchain json test format.""" | ||
try: | ||
BlockchainTestFixtureModel(**self.fixture_json) | ||
except ValidationError as e: | ||
raise Exception( | ||
f"Error in generated blockchain test json ({self.fixture_name})" + e.json() | ||
) | ||
) from ValidationError |