Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#86drpnck9 - Refactor example_tests/test_update_contract.py to use Bo… #1229

Merged
merged 2 commits into from
Apr 4, 2024

Conversation

jplippi
Copy link
Contributor

@jplippi jplippi commented Mar 26, 2024

Summary or solution description
Refactored example_tests/test_update_contract.py files to use BoaTestCase in place of BoaTest for unit testing.

@jplippi jplippi requested a review from meevee98 March 26, 2024 19:35
@melanke
Copy link
Contributor

melanke commented Mar 26, 2024

self.compile(path_new)
@classmethod
def setupTestCase(cls):
cls.owner = cls.node.wallet.account_new(label='owner', password='123')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider using a more descriptive name for the variable cls. It would improve code readability.

@classmethod
def setupTestCase(cls):
cls.owner = cls.node.wallet.account_new(label='owner', password='123')
cls.other_account = cls.node.wallet.account_new(label='otherAccount', password='123')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider using a more descriptive name for the variable cls. It would improve code readability.

def test_update_contract(self):
path, _ = self.get_deploy_file_paths('update_contract.py')
runner = BoaTestRunner(runner_id=self.method_name())
super().setupTestCase()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider using a more descriptive name for the variable cls. It would improve code readability.

def test_update_contract(self):
path, _ = self.get_deploy_file_paths('update_contract.py')
runner = BoaTestRunner(runner_id=self.method_name())
super().setupTestCase()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider using a more descriptive name for the variable cls. It would improve code readability.

invokes = []
expected_results = []
@classmethod
async def asyncSetupClass(cls) -> None:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider using a more descriptive name for the variable cls. It would improve code readability.

expected_results = []
@classmethod
async def asyncSetupClass(cls) -> None:
await super().asyncSetupClass()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider using a more descriptive name for the variable cls. It would improve code readability.


test_account = self.OTHER_ACCOUNT
test_account_script_hash = test_account.script_hash.to_array()
await cls.transfer(CONTRACT_HASHES.GAS_TOKEN, cls.genesis.script_hash, cls.owner.script_hash, 100)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider using a more descriptive name for the variable cls. It would improve code readability.

test_account = self.OTHER_ACCOUNT
test_account_script_hash = test_account.script_hash.to_array()
await cls.transfer(CONTRACT_HASHES.GAS_TOKEN, cls.genesis.script_hash, cls.owner.script_hash, 100)
await cls.transfer(CONTRACT_HASHES.GAS_TOKEN, cls.genesis.script_hash, cls.other_account.script_hash, 100)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider using a more descriptive name for the variable cls. It would improve code readability.

runner.add_gas(self.OWNER.address, self.GAS_TO_DEPLOY)
update_contract = runner.deploy_contract(path, account=self.OWNER)
runner.update_contracts(export_checkpoint=True)
await cls.set_up_contract('update_contract.py', signing_account=cls.owner)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider using a more descriptive name for the variable cls. It would improve code readability.

runner.add_gas(self.OWNER.address, self.GAS_TO_DEPLOY)
update_contract = runner.deploy_contract(path, account=self.OWNER)
runner.update_contracts(export_checkpoint=True)
await cls.set_up_contract('update_contract.py', signing_account=cls.owner)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider using a more descriptive name for the variable cls. It would improve code readability.

@coveralls
Copy link
Collaborator

Coverage Status

coverage: 91.927% (-0.02%) from 91.945%
when pulling 8bddabe on CU-86drpnck9
into d15ecaf on development.

@luc10921 luc10921 merged commit 1a1f407 into development Apr 4, 2024
4 checks passed
@luc10921 luc10921 deleted the CU-86drpnck9 branch April 4, 2024 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants