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)
def test_real_name(self, name, expected): Resource.name = name actual = Resource.real_name() self.assertEqual(actual, expected)
def test_real_end_point(self, end_point, expected): Resource.end_point = end_point actual = Resource.real_end_point() self.assertEqual(actual, expected)