Exemple #1
0
    def test_delete_no_headers(self):
        client = BoxClient('my_token')
        expected_headers = dict(client._headers)

        expected_response = self.make_response()
        flexmock(requests) \
            .should_receive('delete') \
            .with_args('https://api.box.com/2.0/foo',
                       headers=expected_headers,
                       crap=1) \
            .and_return(expected_response) \
            .once()

        actual_response = client._delete('foo', crap=1)
        self.assertEqual(expected_response, actual_response)
Exemple #2
0
    def test_delete(self):
        client = BoxClient('my_token')
        expected_headers = dict(client._headers)
        custom_headers = {'hello': 'world'}
        expected_headers.update(custom_headers)

        expected_response = self.make_response()
        flexmock(requests) \
            .should_receive('delete') \
            .with_args('https://api.box.com/2.0/foo',
                       headers=expected_headers,
                       crap=1) \
            .and_return(expected_response) \
            .once()

        actual_response = client._delete('foo', headers=custom_headers, crap=1)
        self.assertEqual(expected_response, actual_response)

        # verify headers were not modified
        self.assertDictEqual(custom_headers, {'hello': 'world'})