def create_paystack_customer(sender, instance, created, *args, **kwargs): if created: customer = Customer.update( first_name=instance.first_name, last_name=instance.last_name, email=instance.email, phone=instance.phone, )
def test_update(self): """Function defined to test paystackapi customer update.""" httpretty.register_uri( httpretty.PUT, "https://api.paystack.co/customer/4013", content_type='text/json', body='{"status": true, "contributors": true}', status=201, ) response = Customer.update(customer_id=4013, first_name='andela') self.assertEqual(response['status'], True)
def test_update(self): """Function defined to test paystackapi customer update.""" httpretty.register_uri( httpretty.PUT, self.endpoint_url("/customer/4013"), content_type='text/json', body='{"status": true, "contributors": true}', status=201, ) response = Customer.update(customer_id=4013, first_name='andela') self.assertEqual(response['status'], True)
def test_update(self): """Function defined to test paystackapi customer update.""" with mock.patch('paystackapi.customer.Customer.update') as mock_update: mock_update.return_value = { 'status': True, 'message': 'Customer updated', 'data': {'customer_code': 'CUS_jemg85nfijhrp1s', 'first_name': 'andela', 'last_name': 'james', 'domain': 'test', 'id': 4013, 'phone': '08030495860', 'updatedAt': '2016-02-12T14:28:25.000Z', 'integration': 100384, 'email': '*****@*****.**', 'createdAt': '2016-02-12T12:25:19.000Z', 'metadata': None} } response = Customer.update(4013, 'andela') self.assertEqual(response['status'], True)