test_billing.py 文件源码

python
阅读 15 收藏 0 点赞 0 评论 0

项目:dj-paypal 作者: HearthSim 项目源码 文件源码
def test_sync_all_active_plans():
    all_plans = get_fixture("rest.billingplan.all.active.json")
    models.BillingPlan.objects.sync_data(all_plans["plans"])

    assert models.BillingPlan.objects.count() == len(all_plans["plans"])

    for plan in all_plans["plans"]:
        plan_obj = get_fixture(
            "GET/v1/payments/billing-plans/{id}.json".format(id=plan["id"])
        )
        plan = models.BillingPlan.objects.get(id=plan_obj["id"])
        assert plan.id == plan_obj["id"]
        assert plan.state == getattr(enums.BillingPlanState, plan_obj["state"])
        assert plan.type == getattr(enums.BillingPlanType, plan_obj["type"])
        assert plan.name == plan_obj["name"]
        assert plan.description == plan_obj["description"]
        assert plan.merchant_preferences == plan_obj["merchant_preferences"]
        assert plan.create_time == parse_date(plan_obj["create_time"])
        assert plan.update_time == parse_date(plan_obj["update_time"])

        for definition in plan_obj["payment_definitions"]:
            pd = models.PaymentDefinition.objects.get(id=definition["id"])
            assert pd.id == definition["id"]
            assert pd.name == definition["name"]
            assert pd.type == getattr(enums.PaymentDefinitionType, definition["type"])
            assert plan.payment_definitions.filter(id=pd.id).count() == 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号