Esempio n. 1
0
    def test_vimeo_request_basic(self, mock_request):
        mock_response = Mock()
        mock_request.return_value = mock_response
        response = vimeo._vimeo_request('method', 'GET', mydata='blah')

        mock_request.assert_called_with(
            'GET', 'http://vimeo.com/api/rest/v2?method=method', auth=ANY,
            data={'mydata': 'blah', 'format': 'json'})
        mock_response.json.assert_called_with()
        eq_(mock_response.json(), response)
Esempio n. 2
0
    def test_vimeo_request_basic(self, mock_request):
        mock_response = Mock()
        mock_request.return_value = mock_response
        response = vimeo._vimeo_request('method', 'GET', mydata='blah')

        mock_request.assert_called_with(
            'GET',
            'http://vimeo.com/api/rest/v2?method=method',
            auth=ANY,
            data={
                'mydata': 'blah',
                'format': 'json'
            })
        mock_response.json.assert_called_with()
        eq_(mock_response.json(), response)
Esempio n. 3
0
 def test_vimeo_request_error(self, mock_request):
     """If there is an error contacting Vimeo, raise a VimeoServiceError."""
     mock_request.side_effect = requests.RequestException
     with self.assertRaises(vimeo.VimeoServiceError):
         vimeo._vimeo_request('method', 'GET', mydata='blah')
Esempio n. 4
0
 def test_vimeo_request_error(self, mock_request):
     """If there is an error contacting Vimeo, raise a VimeoServiceError."""
     mock_request.side_effect = requests.RequestException
     with self.assertRaises(vimeo.VimeoServiceError):
         vimeo._vimeo_request('method', 'GET', mydata='blah')