def test_put_response(put_method):
  response = fudge.Fake('Response')
  response.provides('json').returns({'qux': 'quux'})
  put_method.is_callable().calls(lambda uri, params, **kwargs: response)

  api = API('abc', '123')

  assert api.put('path') == {'qux': 'quux'}
def test_put(put_method):
  response = fudge.Fake('Response')
  response.provides('json').returns({'qux': 'quux'})

  put_method.expects_call().with_args(
    'https://flying-sphinx.com/api/my/app/path', {'foo': 'bar'}, headers = {
      'Accept':                  'application/vnd.flying-sphinx-v3+json',
      'X-Flying-Sphinx-Token':   'abc:123',
      'X-Flying-Sphinx-Version': ('%s+python' % __version__)
    }
  ).returns(response)

  api = API('abc', '123')
  api.put('path', {'foo': 'bar'})