django.test.Client

  1. from django.test import Client
  2. c = Client()
  3. r = c.get('/api/test/?db=db01')
  4. r = c.get('/api/test/', data={'db': 'db01'})
  5. r = c.post('/api/test/', data={'db': 'db01'})
  6. print(r.content)
  7. print(r.json())