mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-24 16:10:02 -06:00
5ecede781b
On non-usrmerge systems (e.g., Debian), bash, mv, cp, cat, tail, keyctl, and gzip live in /bin, not /usr/bin. On usrmerge systems, /bin is a symlink to /usr/bin (or vice versa), so this has no effect. Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com>
27 lines
632 B
Python
27 lines
632 B
Python
#
|
|
# Copyright (C) 2018 FreeIPA Contributors see COPYING for license
|
|
#
|
|
"""Tests for ipalib.util module
|
|
"""
|
|
|
|
import os
|
|
from unittest import mock
|
|
|
|
import pytest
|
|
|
|
from ipalib.util import get_pager
|
|
|
|
|
|
@pytest.mark.parametrize('pager,expected_result', [
|
|
# Valid values
|
|
('cat', '/bin/cat'),
|
|
('/bin/cat', '/bin/cat'),
|
|
# Invalid values (wrong command, package is not installed, etc)
|
|
('cat_', None),
|
|
('', None)
|
|
])
|
|
def test_get_pager(pager, expected_result):
|
|
with mock.patch.dict(os.environ, {'PAGER': pager}):
|
|
pager = get_pager()
|
|
assert(pager == expected_result or pager.endswith(expected_result))
|