def test_cancel_puts(self): client = mock.Mock() preauth= PreAuthorization(fixtures.preauth_json, client) preauth.cancel() client.api_put.assert_called_with( "/pre_authorizations/{0}/cancel".format( fixtures.preauth_json["id"]))
def test_preauth_create_calls_bill_create(self, mock_bill_class): pre_auth = PreAuthorization(fixtures.preauth_json, None) pre_auth.create_bill(10, name="aname", description="adesc", charge_customer_at="2013-08-27") mock_bill_class.create_under_preauth.assert_called_with(10, pre_auth.id, None, name="aname", description="adesc", charge_customer_at="2013-08-27")
def test_cancel_puts(self): client = mock.Mock() preauth = PreAuthorization(fixtures.preauth_json, client) preauth.cancel() client.api_put.assert_called_with( "/pre_authorizations/{0}/cancel".format( fixtures.preauth_json["id"]))
def test_preauth_create_calls_bill_create(self, mock_bill_class): pre_auth = PreAuthorization(fixtures.preauth_json, None) pre_auth.create_bill(10, name="aname", description="adesc", charge_customer_at="2013-08-27") mock_bill_class.create_under_preauth.assert_called_with( 10, pre_auth.id, None, name="aname", description="adesc", charge_customer_at="2013-08-27", currency=None)
def pre_authorization(self, id): """ Find a pre authorization with id `id` :params id: The pre authorization id """ return PreAuthorization.find_with_client(id, self)