mirror of
https://github.com/httpie/cli.git
synced 2024-11-22 07:43:20 +01:00
33 lines
923 B
Python
33 lines
923 B
Python
from httpie import __version__
|
|
from utils import MockEnvironment, http, HTTP_OK
|
|
from httpie.context import Environment
|
|
|
|
|
|
def test_default_options(httpbin):
|
|
env = MockEnvironment()
|
|
env.config['default_options'] = ['--form']
|
|
env.config.save()
|
|
r = http(httpbin.url + '/post', 'foo=bar', env=env)
|
|
assert r.json['form'] == {"foo": "bar"}
|
|
|
|
|
|
def test_config_dir_not_writeable(httpbin):
|
|
r = http(httpbin + '/get', env=MockEnvironment(
|
|
config_dir='/',
|
|
create_temp_config_dir=False,
|
|
))
|
|
assert HTTP_OK in r
|
|
|
|
|
|
def test_default_options_overwrite(httpbin):
|
|
env = MockEnvironment()
|
|
env.config['default_options'] = ['--form']
|
|
env.config.save()
|
|
r = http('--json', httpbin.url + '/post', 'foo=bar', env=env)
|
|
assert r.json['json'] == {"foo": "bar"}
|
|
|
|
|
|
def test_current_version():
|
|
version = MockEnvironment().config['__meta__']['httpie']
|
|
assert version == __version__
|