def test_find_by_id(self): response = ''' { "name":"Meu Plano", "color":null, "object":"plan", "days":30, "payment_methods":[ "boleto", "credit_card" ], "charges":null, "amount":10000, "installments":1, "trial_days":0, "date_created":"2014-12-23T12:07:57.000Z", "id":10846 } ''' httpretty.register_uri( httpretty.GET, self.api_endpoint + '/10846', body=response, status=200, ) plan = Plan() plan.find_by_id(10846) self.assertEqual(plan.data['id'], 10846)
def test_get_plan_by_id_error(self): plan = Plan(api_key='api_key') with self.assertRaises(PagarmeApiError): plan.find_by_id(20112)
def test_get_plan_by_id(self): plan = Plan(api_key='api_key') plan.find_by_id(20112) self.assertEqual(20112, plan.data['id'])