def test_update(): _plan = plan.create(plan_dictionary.TRIAL_PLAN) assert _plan['trial_days'] == 30 update_plan = plan.update(_plan['id'], plan_dictionary.UPDATE_PLAN) assert update_plan['trial_days'] == 7
def test_create_boleto_plan(): _plan = plan.create(plan_dictionary.BOLETO_PLAN) assert _plan['payment_methods'] == ["boleto"]
def test_find_by(): _plan = plan.create(plan_dictionary.TRIAL_PLAN) time.sleep(3) search_params = {'id': str(_plan['id'])} find_plan = plan.find_by(search_params) assert _plan['id'] == find_plan[0]['id']
def test_create_trial_plan(): _plan = plan.create(plan_dictionary.TRIAL_PLAN) assert _plan['trial_days'] == 30
def test_create_credit_card_plan(): _plan = plan.create(plan_dictionary.CREDIT_CARD_PLAN) assert _plan['payment_methods'] == ["credit_card"]
from pagarme import card from pagarme import plan from tests.resources import pagarme_test from tests.resources.dictionaries import card_dictionary from tests.resources.dictionaries import customer_dictionary from tests.resources.dictionaries import plan_dictionary from tests.resources.dictionaries import transaction_dictionary CARD = card.create(card_dictionary.VALID_CARD) NO_TRIAL_PLAN = plan.create(plan_dictionary.NO_TRIAL_PLAN) POSTBACK_URL = pagarme_test.create_postback_url() BOLETO_PERCENTAGE_SPLIT_RULE_SUBSCRIPTION = { "plan_id": NO_TRIAL_PLAN['id'], "customer": customer_dictionary.CUSTOMER, "payment_method": "boleto", "postback_url": POSTBACK_URL, "split_rules": transaction_dictionary.SPLIT_RULE_PERCENTAGE } BOLETO_SUBSCRIPTION = { "plan_id": NO_TRIAL_PLAN['id'], "customer": customer_dictionary.CUSTOMER, "payment_method": "boleto", "postback_url": POSTBACK_URL } CHARGES = {"charges": "1"}
def test_find_by(retry): _plan = plan.create(plan_dictionary.TRIAL_PLAN) search_params = {'id': str(_plan['id'])} find_plan = retry(lambda: plan.find_by(search_params)) assert _plan['id'] == find_plan[0]['id']