Esempio n. 1
0
def import_format_check(instance: TestCase, res: HttpResponse):
  body = json.loads(res.content)

  format_success_response_check(instance, res)
  data = body.get('data')
  instance.assertIsInstance(data.get('created'), int)
  instance.assertIsInstance(data.get('updated'), int)
  instance.assertIsInstance(data.get('errors'), list)
Esempio n. 2
0
def format_success_response_check(instance: TestCase, res: HttpResponse):
  body = json.loads(res.content)

  instance.assertLess(res.status_code, 300)
  instance.assertLess(body.get('status'), 300)
  instance.assertIsNotNone(body.get('message'))
  instance.assertIsNotNone(body.get('data'))
  instance.assertIsInstance(body.get('data'), dict)
Esempio n. 3
0
def get_list_check(instance: TestCase, res: HttpResponse):
  body = json.loads(res.content)

  instance.assertEqual(res.status_code, 200)
  instance.assertEqual(body.get('status'), 200)
  instance.assertIsInstance(body.get('data'), dict)
  instance.assertIsInstance(body.get('data').get('results'), list)
  format_success_response_check(instance, res)