diff options
| author | Alex Chan <alex@alexwlchan.net> | 2017-07-08 11:50:40 +0100 |
|---|---|---|
| committer | Alex Chan <alex@alexwlchan.net> | 2017-07-27 21:33:42 +0100 |
| commit | 39b121d791ddd2f98ecf7b7f7ba5bae89034e422 (patch) | |
| tree | 0e93582bb1e8af57dc3d3d1cd60a8b69253896ec /tests/test_help.py | |
| parent | 12c74567890666eac84575083d4ace6c6aeb8fb8 (diff) | |
| download | python-requests-39b121d791ddd2f98ecf7b7f7ba5bae89034e422.tar.gz | |
Add idna version info to requests.help
Diffstat (limited to 'tests/test_help.py')
| -rw-r--r-- | tests/test_help.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_help.py b/tests/test_help.py index f08fdd97..c11d43f3 100644 --- a/tests/test_help.py +++ b/tests/test_help.py @@ -19,3 +19,22 @@ def test_system_ssl_py26(): def test_system_ssl(): """Verify we're actually setting system_ssl when it should be available.""" assert info()['system_ssl']['version'] != '' + + +class VersionedPackage(object): + def __init__(self, version): + self.__version__ = version + + +def test_idna_without_version_attribute(mocker): + """Older versions of IDNA don't provide a __version__ attribute, verify + that if we have such a package, we don't blow up. + """ + mocker.patch('requests.help.idna', new=None) + assert info()['idna'] == {'version': ''} + + +def test_idna_with_version_attribute(mocker): + """Verify we're actually setting idna version when it should be available.""" + mocker.patch('requests.help.idna', new=VersionedPackage('2.6')) + assert info()['idna'] == {'version': '2.6'} |
