def test_create(self): response = ''' { "name":"Meu Plano", "color":null, "object":"plan", "days":30, "payment_methods":[ "boleto", "credit_card" ], "charges":"10", "amount":10000, "installments":"1", "trial_days":10, "date_created":"2014-12-23T12:19:19.000Z", "id":10848 } ''' httpretty.register_uri( httpretty.POST, self.api_endpoint, body=response, status=200, ) plan = Plan(amount='10000', days=30, name='Meu Plano', trial_days=10, charges=10, installments=1) plan.create() self.assertEqual(plan.data['id'], 10848)
def test_create(self): response = ''' { "name":"Meu Plano", "color":null, "object":"plan", "days":30, "payment_methods":[ "boleto", "credit_card" ], "charges":"10", "amount":10000, "installments":"1", "trial_days":10, "date_created":"2014-12-23T12:19:19.000Z", "id":10848 } ''' httpretty.register_uri( httpretty.POST, self.api_endpoint, body=response, status=200, ) plan = Plan( amount='10000', days=30, name='Meu Plano', trial_days=10, charges=10, installments=1 ) plan.create() self.assertEqual(plan.data['id'], 10848)
def test_can_create(self): plan = Plan(api_key='api_key', name='Test plan', color='red' ) plan.create() self.assertEqual(20112, plan.data['id'])
def test_create_plan_error(self): plan = Plan(api_key='api_key') with self.assertRaises(PagarmeApiError): plan.create()