-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_chmod.py
81 lines (49 loc) · 1.36 KB
/
test_chmod.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
from chmod import Chmod
def test_text1():
c = Chmod('rwxrwxrwx')
assert c.getNumeric() == '777'
def test_text2():
c = Chmod('rwxr-xr-x')
assert c.getNumeric() == '755'
def test_text3():
c = Chmod('rw-r--r--')
assert c.getNumeric() == '644'
def test_text4():
c = Chmod('rwx------')
assert c.getNumeric() == '700'
def test_text_same():
c = Chmod('rwxrwxrwx')
assert c.getText() == 'rwxrwxrwx'
def test_text_incomplete():
c = Chmod('rwxrwx')
assert c.getNumeric() == 'rwxrwx'
def test_text_larger():
c = Chmod('rwxrwxrwxrwx')
assert c.getNumeric() == 'rwxrwxrwxrwx'
def test_text_wrong_letter():
c = Chmod('abc')
assert c.getNumeric() == 'abc'
def test_numeric1():
c = Chmod('777')
assert c.getText() == 'rwxrwxrwx'
def test_numeric2():
c = Chmod('755')
assert c.getText() == 'rwxr-xr-x'
def test_numeric3():
c = Chmod('644')
assert c.getText() == 'rw-r--r--'
def test_numeric4():
c = Chmod('700')
assert c.getText() == 'rwx------'
def test_numeric_same():
c = Chmod('777')
assert c.getNumeric() == '777'
def test_numeric_incomplete():
c = Chmod('77')
assert c.getText() == '77'
def test_numeric_bigger():
c = Chmod('777777777')
assert c.getText() == '777777777'
def test_numeric_wrong():
c = Chmod('999')
assert c.getText() == '999'