def test_response(self, content, status_code, wrap, meta, expected): actual_response, actual_status = Resource.response(content, status_code, wrap, **meta) self.assertEqual(actual_status, status_code) if isinstance(expected, dict): self.assertDictEqual(actual_response, expected) elif isinstance(expected, list): self.assertListEqual(actual_response, expected) else: self.assertEqual(actual_response, expected)
def test_response_raises_error_when_not_wrapping_lists(self): with self.assertRaises(ValueError): Resource.response([1, 2, 3], count=3, wrap=False)