summaryrefslogtreecommitdiff
path: root/tests/test_which.py
diff options
context:
space:
mode:
authorJeff Quast <contact@jeffquast.com>2014-08-25 07:02:51 +0000
committerJeff Quast <contact@jeffquast.com>2014-08-25 07:02:51 +0000
commit31e56b446b9b7c491a0fc91dbc80d111345c8b00 (patch)
treedd3c97e78303cedd06d6d5202fbcdba2441f2f20 /tests/test_which.py
parent67e6c4ac018a0dabe50962beba537612cfb4fa22 (diff)
downloadpexpect-git-31e56b446b9b7c491a0fc91dbc80d111345c8b00.tar.gz
Add tests for running as root on Solaris, using
'isroot' check.
Diffstat (limited to 'tests/test_which.py')
-rw-r--r--tests/test_which.py64
1 files changed, 32 insertions, 32 deletions
diff --git a/tests/test_which.py b/tests/test_which.py
index ed9493d..ec9fbb8 100644
--- a/tests/test_which.py
+++ b/tests/test_which.py
@@ -186,39 +186,39 @@ class TestCaseWhich(PexpectTestCase.PexpectTestCase):
if not bin_echo or not bin_which:
pytest.skip('needs `echo` and `which` binaries')
shutil.copy(bin_echo, bin_path)
-
+ isroot = os.getuid() == 0
for should_match, mode in (
- (False, 0o000), # ----------, no
- (False, 0o001), # ---------x, no
- (False, 0o010), # ------x---, no
- (True, 0o100), # ---x------, yes
- (False, 0o002), # --------w-, no
- (False, 0o020), # -----w----, no
- (False, 0o200), # --w-------, no
- (False, 0o003), # --------wx, no
- (False, 0o030), # -----wx---, no
- (True, 0o300), # --wx------, yes
- (False, 0o004), # -------r--, no
- (False, 0o040), # ----r-----, no
- (False, 0o400), # -r--------, no
- (False, 0o005), # -------r-x, no
- (False, 0o050), # ----r-x---, no
- (True, 0o500), # -r-x------, yes
- (False, 0o006), # -------rw-, no
- (False, 0o060), # ----rw----, no
- (False, 0o600), # -rw-------, no
- (False, 0o007), # -------rwx, no
- (False, 0o070), # ----rwx---, no
- (True, 0o700), # -rwx------, yes
- (False, 0o4001), # ---S-----x, no
- (False, 0o4010), # ---S--x---, no
- (True, 0o4100), # ---s------, yes
- (False, 0o4003), # ---S----wx, no
- (False, 0o4030), # ---S-wx---, no
- (True, 0o4300), # --ws------, yes
- (False, 0o2001), # ------S--x, no
- (False, 0o2010), # ------s---, no
- (True, 0o2100), # ---x--S---, yes
+ (False, 0o000), # ----------, no
+ (isroot, 0o001), # ---------x, no
+ (isroot, 0o010), # ------x---, no
+ (True, 0o100), # ---x------, yes
+ (False, 0o002), # --------w-, no
+ (False, 0o020), # -----w----, no
+ (False, 0o200), # --w-------, no
+ (isroot, 0o003), # --------wx, no
+ (isroot, 0o030), # -----wx---, no
+ (True, 0o300), # --wx------, yes
+ (False, 0o004), # -------r--, no
+ (False, 0o040), # ----r-----, no
+ (False, 0o400), # -r--------, no
+ (isroot, 0o005), # -------r-x, no
+ (isroot, 0o050), # ----r-x---, no
+ (True, 0o500), # -r-x------, yes
+ (False, 0o006), # -------rw-, no
+ (False, 0o060), # ----rw----, no
+ (False, 0o600), # -rw-------, no
+ (isroot, 0o007), # -------rwx, no
+ (isroot, 0o070), # ----rwx---, no
+ (True, 0o700), # -rwx------, yes
+ (isroot, 0o4001), # ---S-----x, no
+ (isroot, 0o4010), # ---S--x---, no
+ (True, 0o4100), # ---s------, yes
+ (isroot, 0o4003), # ---S----wx, no
+ (isroot, 0o4030), # ---S-wx---, no
+ (True, 0o4300), # --ws------, yes
+ (isroot, 0o2001), # ------S--x, no
+ (isroot, 0o2010), # ------s---, no
+ (True, 0o2100), # ---x--S---, yes
):
mode_str = '{0:0>4o}'.format(mode)