Exemple #1
0
    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)
Exemple #2
0
 def test_response_raises_error_when_not_wrapping_lists(self):
     with self.assertRaises(ValueError):
         Resource.response([1, 2, 3], count=3, wrap=False)
Exemple #3
0
    def test_real_name(self, name, expected):
        Resource.name = name

        actual = Resource.real_name()
        self.assertEqual(actual, expected)
Exemple #4
0
    def test_real_end_point(self, end_point, expected):
        Resource.end_point = end_point

        actual = Resource.real_end_point()
        self.assertEqual(actual, expected)