def config(tmp_path, mocker): test_configuration = prepare_conf(tmp_path) mocker.patch('eth_wallet.configuration.Configuration.load_configuration', return_value=test_configuration) mocker.patch('getpass.getpass', return_value="my-password") call_eth_wallet(eth_wallet_cli, parameters=["new-wallet"]) return test_configuration
def test_account(tmp_path): test_configuration = prepare_conf(tmp_path) WalletAPI.new_wallet(test_configuration, 'my-password') assert len(list( tmp_path.iterdir())) == 2 # one config.yaml and one keystore address, pub_key = WalletAPI.get_wallet(test_configuration) public_key_bytes = decode_hex(pub_key) assert len(public_key_bytes) == 64 assert Web3.isAddress(address) assert Web3.isChecksumAddress(address)
def __init__(self): self.conf = prepare_conf() self.headers = {'Authorization': f'token {self.conf.github_token}'} self.repo = None self.random_string = None # This token needs github api token scope to delete repositories. If deleting a repo fails with # a message saying that you need to be admin for such action it means the token doesn't have it. # We suggest creating a new token with such scope: # https://github.com/settings/tokens/new self.github_token = self.conf.github_token self.github_user = self.get_username()
def test_account(tmp_path): test_configuration = prepare_conf(tmp_path) # mocker.patch('eth_wallet.configuration.Configuration.__init__', # return_value=test_config) WalletAPI.new_wallet(test_configuration, 'my-password') assert len(list( tmp_path.iterdir())) == 2 # one config.yaml and one keystore address, pub_key = WalletAPI.get_wallet(test_configuration) public_key_bytes = decode_hex(pub_key) assert len(public_key_bytes) == 64 assert Web3.isAddress(address) assert Web3.isChecksumAddress(address)
def setup_method(self): """ setup any state tied to the execution of the given method in a class. setup_method is invoked for every test method of a class. """ configuration = prepare_conf() self.g_utils = GithubUtils() self.github_user = self.g_utils.github_user self.g_utils.create_repo() self.g_utils.setup_repo() # set conf configuration.repository_name = self.g_utils.repo configuration.repository_owner = self.github_user configuration.github_username = self.github_user configuration.refresh_interval = 1 self.release_bot = ReleaseBot(configuration)
def setup_method(self): """ setup any state tied to the execution of the given method in a class. setup_method is invoked for every test method of a class. """ configuration = prepare_conf() self.g_utils = GithubUtils() self.g_utils.create_repo() self.g_utils.setup_repo() # set conf configuration.repository_name = self.g_utils.repo configuration.github_username = self.g_utils.github_user configuration.refresh_interval = 1 repo_url = f"https://github.com/{self.g_utils.github_user}/{self.g_utils.repo}" git = Git(repo_url, configuration) self.github = Github(configuration, git)
def setup_method(self): """ setup any state tied to the execution of the given method in a class. setup_method is invoked for every test method of a class. """ configuration = prepare_conf() self.g_utils = GithubUtils() self.github_user = self.g_utils.github_user self.g_utils.create_repo() self.g_utils.setup_repo() # set conf configuration.repository_name = self.g_utils.repo configuration.repository_owner = self.github_user configuration.github_username = self.github_user configuration.clone_url = f'https://github.com/{self.github_user}/{self.g_utils.repo}.git' configuration.refresh_interval = DEFAULT_REFRESH_INTERVAL configuration.project = configuration.get_project() self.release_bot = ReleaseBot(configuration)
def configuration(tmp_path): return prepare_conf(tmp_path)
def test_latest_release(expected_f): expected = expected_f() co = prepare_conf() g = Github(co, None) assert g.latest_release() == expected