def test_invalid_signing(wallet_3hf: Wallet, budget, account): update_budget_time(wallet_3hf, budget) validate_error_response( wallet_3hf.broadcast_multiple_ops('create_budget_operation', [budget], {account}), 'create_budget_operation', RE_MISSING_AUTHORITY )
def test_close_budget_by_adv_moderator_locked(wallet: Wallet, budget, moderator): response = wallet.close_budget_by_advertising_moderator( gen_uid(), moderator, budget["type"]) validate_error_response( response, wallet.close_budget_by_advertising_moderator.__name__, RE_OP_IS_LOCKED)
def test_unknown_uuid(wallet_3hf: Wallet, opened_budgets, uuid, moderator): empower_advertising_moderator(wallet_3hf, moderator) validate_error_response( wallet_3hf.close_budget_by_advertising_moderator( uuid(), moderator, opened_budgets[0]["type"]), wallet_3hf.close_budget_by_advertising_moderator.__name__, RE_BUDGET_NOT_EXIST)
def test_invalid_signing(wallet_3hf: Wallet, budget, account): update_budget_time(wallet_3hf, budget) data = {'uuid': budget['uuid'], 'owner': budget['owner'], 'type': budget['type']} validate_error_response( wallet_3hf.broadcast_multiple_ops('close_budget_operation', [data], {account}), 'close_budget_operation', RE_MISSING_AUTHORITY )
def test_invalid_coeffs(wallet_3hf: Wallet, budget_type, coeffs): response = wallet_3hf.development_committee_change_budgets_auction_properties( DEFAULT_WITNESS, coeffs, 86400, budget_type ) validate_error_response(response, wallet_3hf.development_committee_change_budgets_auction_properties.__name__) proposals = wallet_3hf.list_proposals() assert len(proposals) == 0, "Was created %d proposals, expected only one: %s" % (len(proposals), proposals) assert coeffs != wallet_3hf.get_auction_coefficients(budget_type), "Coefficients was changed, but they shouldn't."
def test_development_committee_change_budgets_auction_properties( wallet: Wallet, type): response = wallet.development_committee_change_budgets_auction_properties( DEFAULT_WITNESS, [90, 50], type=type) validate_error_response( response, wallet. development_committee_change_budgets_auction_properties.__name__, RE_OP_IS_LOCKED)
def test_invalid_signing(wallet_3hf: Wallet, account, budget): data = { 'initiator': DEFAULT_WITNESS, 'coeffs': [100, 99, 98], 'lifetime': 86400, 'type': budget['type'] } validate_error_response( wallet_3hf.broadcast_multiple_ops('development_committee_change_budgets_auction_properties', [data], {account}), 'development_committee_change_budgets_auction_properties', RE_MISSING_AUTHORITY )
def test_update_budget_invalid_meta(wallet_3hf: Wallet, budget, json_metadata): update_budget_time(wallet_3hf, budget) wallet_3hf.create_budget(**budget) update_budget_balance(wallet_3hf, budget) response = wallet_3hf.update_budget(budget['uuid'], budget['owner'], json_metadata, budget['type']) validate_error_response(response, wallet_3hf.update_budget.__name__, RE_PARSE_ERROR) budget_obj = wallet_3hf.get_budget(budget['uuid'], budget['type']) assert budget_obj['json_metadata'] == budget["json_metadata"]
def test_devcommittee_withdraw_gt_pool(wallet: Wallet): devcommittee = wallet.get_development_committee() validate_response(devcommittee, wallet.get_development_committee.__name__) amount = Amount(devcommittee["sp_balance"]) + Amount("100.000000000 SP") validate_response( wallet.devcommittee_withdraw_vesting(DEFAULT_WITNESS, amount), wallet.devcommittee_withdraw_vesting.__name__ ) proposals = wallet.list_proposals() validate_response(proposals, wallet.list_proposals.__name__) expect(len(proposals) == 1, "Was created %d proposals, expected only one: %s" % (len(proposals), proposals)) validate_error_response(wallet.proposal_vote(DEFAULT_WITNESS, proposals[0]["id"]), wallet.proposal_vote.__name__)
def test_close_budgets(wallet_3hf: Wallet, opened_budgets_same_acc): budgets = opened_budgets_same_acc # just renaming validate_response( wallet_3hf.close_budget(budgets[0]["uuid"], budgets[0]["owner"], budgets[0]["type"]), wallet_3hf.close_budget.__name__ ) rest_budgets = wallet_3hf.get_budgets([budgets[-1]["owner"]], budgets[-1]["type"]) assert len(rest_budgets) == len(budgets) - 1 assert all(rb["id"] != budgets[0]["id"] for rb in rest_budgets) # delete already deleted validate_error_response( wallet_3hf.close_budget(budgets[0]['uuid'], budgets[0]["owner"], budgets[0]["type"]), wallet_3hf.close_budget.__name__, RE_BUDGET_NOT_EXIST )
def test_close_budgets(wallet_3hf: Wallet, moderator, opened_budgets_same_acc): budgets = opened_budgets_same_acc # just renaming empower_advertising_moderator(wallet_3hf, moderator) validate_response( wallet_3hf.close_budget_by_advertising_moderator( budgets[0]["uuid"], moderator, budgets[0]["type"]), wallet_3hf.close_budget_by_advertising_moderator.__name__) rest_budgets = wallet_3hf.get_budgets([budgets[-1]["owner"]], budgets[-1]["type"]) assert len(rest_budgets) == len(budgets) - 1 assert all(rb["id"] != budgets[0]["id"] for rb in rest_budgets) # delete already deleted validate_error_response( wallet_3hf.close_budget_by_advertising_moderator( budgets[0]["uuid"], moderator, budgets[0]["type"]), wallet_3hf.close_budget_by_advertising_moderator.__name__, RE_BUDGET_NOT_EXIST)
def test_create_max_budgets(wallet_3hf: Wallet, budget): re_budgets_limit = r"Can't create more then .* budgets per owner." limit = wallet_3hf.get_config()["SCORUM_BUDGETS_LIMIT_PER_OWNER"] balance = "0.000000001 SCR" update_budget_time(wallet_3hf, budget, start=5, deadline=300) budgets = [] for i in range(1, limit + 1): budget_cp = copy(budget) budget_cp.update({'uuid': gen_uid(), 'balance': balance}) budgets.append(budget_cp) validate_response( wallet_3hf.broadcast_multiple_ops('create_budget_operation', budgets, {budget['owner']}), 'create_budget_operation' ) update_budget_time(wallet_3hf, budget, start=5, deadline=300) validate_error_response( wallet_3hf.create_budget(**budget), wallet_3hf.create_budget.__name__, re_budgets_limit ) wallet_3hf.close_budget(str(budgets[0]['uuid']), budget['owner'], budget['type']) update_budget_time(wallet_3hf, budget, start=5, deadline=300) validate_response(wallet_3hf.create_budget(**budget), wallet_3hf.create_budget.__name__)
def test_empower_adv_moderator_locked(wallet: Wallet, budget, moderator): response = wallet.development_committee_empower_advertising_moderator( DEFAULT_WITNESS, moderator) validate_error_response( response, wallet.development_committee_empower_advertising_moderator, RE_OP_IS_LOCKED)
def test_create_budget_invalid_params(wallet_3hf: Wallet, budget, params, err_response_code): update_budget_time(wallet_3hf, budget) budget.update(params) response = wallet_3hf.create_budget(**budget) validate_error_response(response, wallet_3hf.create_budget.__name__, err_response_code)
def test_unknown_uuid(wallet_3hf: Wallet, opened_budgets, uuid): validate_error_response( wallet_3hf.close_budget(uuid(), opened_budgets[0]["owner"], opened_budgets[0]["type"]), wallet_3hf.close_budget.__name__, RE_BUDGET_NOT_EXIST )
def test_vote_operation_2hf_invalid(wallet: Wallet, post, weight): apply_hardfork(wallet, 2) account = post["author"] validate_response(wallet.post_comment(**post), wallet.post_comment.__name__) validate_error_response(wallet.vote(account, account, post["permlink"], weight=weight), wallet.vote.__name__)
def test_update_budget_locked(wallet: Wallet, budget): response = wallet.update_budget(gen_uid(), DEFAULT_WITNESS, "{}", budget["type"]) validate_error_response(response, wallet.close_budget.__name__, RE_OP_IS_LOCKED)
def test_create_budget_locked(wallet: Wallet, budget): response = wallet.create_budget(**budget) validate_error_response(response, wallet.create_budget.__name__, RE_OP_IS_LOCKED)