当前位置: 首页>>代码示例>>Python>>正文


Python CompanyModel.get方法代码示例

本文整理汇总了Python中billy.models.company.CompanyModel.get方法的典型用法代码示例。如果您正苦于以下问题:Python CompanyModel.get方法的具体用法?Python CompanyModel.get怎么用?Python CompanyModel.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在billy.models.company.CompanyModel的用法示例。


在下文中一共展示了CompanyModel.get方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

# 需要导入模块: from billy.models.company import CompanyModel [as 别名]
# 或者: from billy.models.company.CompanyModel import get [as 别名]
 def setUp(self):
     from billy.models.company import CompanyModel
     from billy.models.customer import CustomerModel
     from billy.models.plan import PlanModel
     self.settings = {
         'billy.processor_factory': DummyProcessor
     }
     super(TestSubscriptionViews, self).setUp()
     company_model = CompanyModel(self.testapp.session)
     customer_model = CustomerModel(self.testapp.session)
     plan_model = PlanModel(self.testapp.session)
     with db_transaction.manager:
         self.company_guid = company_model.create(
             processor_key='MOCK_PROCESSOR_KEY',
         )
         self.customer_guid = customer_model.create(
             company_guid=self.company_guid
         )
         self.plan_guid = plan_model.create(
             company_guid=self.company_guid,
             frequency=plan_model.FREQ_WEEKLY,
             plan_type=plan_model.TYPE_CHARGE,
             amount=10,
         )
     company = company_model.get(self.company_guid)
     self.api_key = str(company.api_key)
开发者ID:mjallday,项目名称:billy,代码行数:28,代码来源:test_subscription.py

示例2: test_get_subscription_of_other_company

# 需要导入模块: from billy.models.company import CompanyModel [as 别名]
# 或者: from billy.models.company.CompanyModel import get [as 别名]
    def test_get_subscription_of_other_company(self):
        from billy.models.company import CompanyModel
        from billy.models.customer import CustomerModel
        from billy.models.plan import PlanModel

        company_model = CompanyModel(self.testapp.session)
        customer_model = CustomerModel(self.testapp.session)
        plan_model = PlanModel(self.testapp.session)
        with db_transaction.manager:
            other_company_guid = company_model.create(processor_key="MOCK_PROCESSOR_KEY")
            other_customer_guid = customer_model.create(company_guid=other_company_guid)
            other_plan_guid = plan_model.create(
                company_guid=other_company_guid,
                frequency=plan_model.FREQ_WEEKLY,
                plan_type=plan_model.TYPE_CHARGE,
                amount=10,
            )
        other_company = company_model.get(other_company_guid)
        other_api_key = str(other_company.api_key)

        res = self.testapp.post(
            "/v1/subscriptions",
            dict(customer_guid=other_customer_guid, plan_guid=other_plan_guid),
            extra_environ=dict(REMOTE_USER=other_api_key),
            status=200,
        )
        other_guid = res.json["guid"]

        self.testapp.get(
            "/v1/subscriptions/{}".format(other_guid), extra_environ=dict(REMOTE_USER=self.api_key), status=403
        )
开发者ID:JeffersonK,项目名称:billy,代码行数:33,代码来源:test_subscription.py

示例3: setUp

# 需要导入模块: from billy.models.company import CompanyModel [as 别名]
# 或者: from billy.models.company.CompanyModel import get [as 别名]
 def setUp(self):
     from billy.models.company import CompanyModel
     super(TestPlanViews, self).setUp()
     model = CompanyModel(self.testapp.session)
     with db_transaction.manager:
         self.company_guid = model.create(processor_key='MOCK_PROCESSOR_KEY')
     company = model.get(self.company_guid)
     self.api_key = str(company.api_key)
开发者ID:mjallday,项目名称:billy,代码行数:10,代码来源:test_plan.py

示例4: test_company

# 需要导入模块: from billy.models.company import CompanyModel [as 别名]
# 或者: from billy.models.company.CompanyModel import get [as 别名]
 def test_company(self):
     from billy.models.company import CompanyModel
     from billy.renderers import company_adapter
     company_model = CompanyModel(self.testapp.session)
     company = company_model.get(self.company_guid)
     json_data = company_adapter(company, self.dummy_request)
     expected = dict(
         guid=company.guid,
         api_key=company.api_key,
         created_at=company.created_at.isoformat(),
         updated_at=company.updated_at.isoformat(),
     )
     self.assertEqual(json_data, expected)
开发者ID:JeffersonK,项目名称:billy,代码行数:15,代码来源:test_renderer.py

示例5: company_get

# 需要导入模块: from billy.models.company import CompanyModel [as 别名]
# 或者: from billy.models.company.CompanyModel import get [as 别名]
def company_get(request):
    """Get and return a company

    """
    api_company = auth_api_key(request)
    model = CompanyModel(request.session)
    guid = request.matchdict['company_guid']
    company = model.get(guid)
    if company is None:
        return HTTPNotFound('No such company {}'.format(guid))
    if guid != api_company.guid:
        return HTTPForbidden('You have no premission to access company {}'.format(guid))
    return company
开发者ID:JeffersonK,项目名称:billy,代码行数:15,代码来源:views.py

示例6: company_list_post

# 需要导入模块: from billy.models.company import CompanyModel [as 别名]
# 或者: from billy.models.company.CompanyModel import get [as 别名]
def company_list_post(request):
    """Create a new company

    """
    form = validate_form(CompanyCreateForm, request)
    processor_key = form.data['processor_key']

    model = CompanyModel(request.session)
    # TODO: do validation here
    with db_transaction.manager:
        guid = model.create(processor_key=processor_key)
    company = model.get(guid)
    return company
开发者ID:JeffersonK,项目名称:billy,代码行数:15,代码来源:views.py

示例7: test_get_customer_of_other_company

# 需要导入模块: from billy.models.company import CompanyModel [as 别名]
# 或者: from billy.models.company.CompanyModel import get [as 别名]
 def test_get_customer_of_other_company(self):
     from billy.models.company import CompanyModel
     model = CompanyModel(self.testapp.session)
     with db_transaction.manager:
         other_company_guid = model.create(processor_key='MOCK_PROCESSOR_KEY')
     other_company = model.get(other_company_guid)
     other_api_key = str(other_company.api_key)
     res = self.testapp.post(
         '/v1/customers', 
         extra_environ=dict(REMOTE_USER=other_api_key), 
         status=200,
     )
     guid = res.json['guid']
     res = self.testapp.get(
         '/v1/customers/{}'.format(guid), 
         extra_environ=dict(REMOTE_USER=self.api_key), 
         status=403,
     )
开发者ID:JeffersonK,项目名称:billy,代码行数:20,代码来源:test_customer.py

示例8: test_cancel_subscription_to_other_company

# 需要导入模块: from billy.models.company import CompanyModel [as 别名]
# 或者: from billy.models.company.CompanyModel import get [as 别名]
    def test_cancel_subscription_to_other_company(self):
        from billy.models.subscription import SubscriptionModel
        from billy.models.company import CompanyModel

        subscription_model = SubscriptionModel(self.testapp.session)
        company_model = CompanyModel(self.testapp.session)

        with db_transaction.manager:
            subscription_guid = subscription_model.create(customer_guid=self.customer_guid, plan_guid=self.plan_guid)
            other_company_guid = company_model.create(processor_key="MOCK_PROCESSOR_KEY")
            other_company = company_model.get(other_company_guid)
            other_api_key = str(other_company.api_key)

        self.testapp.post(
            "/v1/subscriptions/{}/cancel".format(subscription_guid),
            extra_environ=dict(REMOTE_USER=other_api_key),
            status=403,
        )
开发者ID:JeffersonK,项目名称:billy,代码行数:20,代码来源:test_subscription.py

示例9: setUp

# 需要导入模块: from billy.models.company import CompanyModel [as 别名]
# 或者: from billy.models.company.CompanyModel import get [as 别名]
 def setUp(self):
     from billy.models.company import CompanyModel
     from billy.models.customer import CustomerModel
     from billy.models.plan import PlanModel
     from billy.models.subscription import SubscriptionModel
     from billy.models.transaction import TransactionModel
     super(TestTransactionViews, self).setUp()
     company_model = CompanyModel(self.testapp.session)
     customer_model = CustomerModel(self.testapp.session)
     plan_model = PlanModel(self.testapp.session)
     subscription_model = SubscriptionModel(self.testapp.session)
     transaction_model = TransactionModel(self.testapp.session)
     with db_transaction.manager:
         self.company_guid = company_model.create(
             processor_key='MOCK_PROCESSOR_KEY',
         )
         self.customer_guid = customer_model.create(
             company_guid=self.company_guid
         )
         self.plan_guid = plan_model.create(
             company_guid=self.company_guid,
             frequency=plan_model.FREQ_WEEKLY,
             plan_type=plan_model.TYPE_CHARGE,
             amount=10,
         )
         self.subscription_guid = subscription_model.create(
             customer_guid=self.customer_guid,
             plan_guid=self.plan_guid,
         )
         self.transaction_guid = transaction_model.create(
             subscription_guid=self.subscription_guid,
             transaction_type=transaction_model.TYPE_CHARGE,
             amount=10,
             payment_uri='/v1/cards/tester',
             scheduled_at=datetime.datetime.utcnow(),
         )
     company = company_model.get(self.company_guid)
     self.api_key = str(company.api_key)
开发者ID:mjallday,项目名称:billy,代码行数:40,代码来源:test_transaction.py

示例10: test_get_plan_of_other_company

# 需要导入模块: from billy.models.company import CompanyModel [as 别名]
# 或者: from billy.models.company.CompanyModel import get [as 别名]
 def test_get_plan_of_other_company(self):
     from billy.models.company import CompanyModel
     model = CompanyModel(self.testapp.session)
     with db_transaction.manager:
         other_company_guid = model.create(processor_key='MOCK_PROCESSOR_KEY')
     other_company = model.get(other_company_guid)
     other_api_key = str(other_company.api_key)
     res = self.testapp.post(
         '/v1/plans', 
         dict(
             plan_type='charge',
             amount='55.66',
             frequency='weekly',
         ),
         extra_environ=dict(REMOTE_USER=other_api_key), 
         status=200,
     )
     guid = res.json['guid']
     res = self.testapp.get(
         '/v1/plans/{}'.format(guid), 
         extra_environ=dict(REMOTE_USER=self.api_key), 
         status=403,
     )
开发者ID:mjallday,项目名称:billy,代码行数:25,代码来源:test_plan.py


注:本文中的billy.models.company.CompanyModel.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。