Пример #1
0
class TestResponse(TestCase):
    def setUp(self):
        self.request_mock = mock.MagicMock()
        self.response = Response(request=self.request_mock)

    def test_location_header(self):
        self.request_mock.url = 'http://testurl/api'
        self.response.location_header(10)
        self.assertEqual(self.response.headers['Location'],
                         'http://testurl/api/10')

    def test_get_response_data_raises_error(self):
        self.assertRaises(NotImplementedError, self.response.get_response_data)
Пример #2
0
class TestResponse(TestCase):

    def setUp(self):
        self.request_mock = mock.MagicMock()
        self.response = Response(request=self.request_mock)

    def test_location_header(self):
        self.request_mock.url = 'http://testurl/api'
        self.response.location_header(10)
        self.assertEqual(self.response.headers['Location'],
                         'http://testurl/api/10')

    def test_get_response_data_raises_error(self):
        self.assertRaises(NotImplementedError, self.response.get_response_data)
Пример #3
0
 def setUp(self):
     self.request_mock = mock.MagicMock()
     self.response = Response(request=self.request_mock)
Пример #4
0
 def setUp(self):
     self.request_mock = mock.MagicMock()
     self.response = Response(request=self.request_mock)