From 8936d1b71e37da66312ad3068b80811006768896 Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Thu, 16 Apr 2020 11:28:21 +0200 Subject: [PATCH] Add tests for `--offline` --- tests/test_httpie.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/test_httpie.py b/tests/test_httpie.py index 66caba52..959287c9 100644 --- a/tests/test_httpie.py +++ b/tests/test_httpie.py @@ -181,3 +181,23 @@ def test_json_input_preserve_order(httpbin_both): assert HTTP_OK in r assert r.json['data'] == \ '{"order": {"map": {"1": "first", "2": "second"}}}' + + +def test_offline(): + r = http( + '--offline', + 'https://this-should.never-resolve/foo', + 'param==value' + ) + assert 'GET /foo?param=value' in r + + +def test_offline_download(): + """Absence of response should be handled gracefully with --download""" + r = http( + '--offline', + '--download', + 'https://this-should.never-resolve/foo', + 'param==value' + ) + assert 'GET /foo?param=value' in r