10
10
raise Exception ("Add the SDK repository to your PYTHONPATH to run the test cases "
11
11
"(e.g., export PYTHONPATH=~/splunk-sdk-python." )
12
12
13
-
14
13
TEST_DICT = {
15
- 'username' :'admin' ,
16
- 'password' :'changeme' ,
17
- 'port' : 8089 ,
18
- 'host' : 'localhost' ,
19
- 'scheme' : 'https'
20
- }
14
+ 'username' : 'admin' ,
15
+ 'password' : 'changeme' ,
16
+ 'port' : 8089 ,
17
+ 'host' : 'localhost' ,
18
+ 'scheme' : 'https'
19
+ }
20
+
21
21
22
22
class TestUtils (testlib .SDKTestCase ):
23
23
def setUp (self ):
@@ -26,16 +26,16 @@ def setUp(self):
26
26
# Test dslice when a dict is passed to change key names
27
27
def test_dslice_dict_args (self ):
28
28
args = {
29
- 'username' :'user-name' ,
30
- 'password' :'new_password' ,
31
- 'port' : 'admin_port' ,
32
- 'foo' :'bar'
33
- }
29
+ 'username' : 'user-name' ,
30
+ 'password' : 'new_password' ,
31
+ 'port' : 'admin_port' ,
32
+ 'foo' : 'bar'
33
+ }
34
34
expected = {
35
- 'user-name' :'admin' ,
36
- 'new_password' :'changeme' ,
37
- 'admin_port' :8089
38
- }
35
+ 'user-name' : 'admin' ,
36
+ 'new_password' : 'changeme' ,
37
+ 'admin_port' : 8089
38
+ }
39
39
self .assertTrue (expected == dslice (TEST_DICT , args ))
40
40
41
41
# Test dslice when a list is passed
@@ -46,44 +46,46 @@ def test_dslice_list_args(self):
46
46
'port' ,
47
47
'host' ,
48
48
'foo'
49
- ]
49
+ ]
50
50
expected = {
51
- 'username' :'admin' ,
52
- 'password' :'changeme' ,
53
- 'port' :8089 ,
54
- 'host' :'localhost'
55
- }
51
+ 'username' : 'admin' ,
52
+ 'password' : 'changeme' ,
53
+ 'port' : 8089 ,
54
+ 'host' : 'localhost'
55
+ }
56
56
self .assertTrue (expected == dslice (TEST_DICT , test_list ))
57
57
58
58
# Test dslice when a single string is passed
59
59
def test_dslice_arg (self ):
60
60
test_arg = 'username'
61
61
expected = {
62
- 'username' :'admin'
63
- }
62
+ 'username' : 'admin'
63
+ }
64
64
self .assertTrue (expected == dslice (TEST_DICT , test_arg ))
65
65
66
66
# Test dslice using all three types of arguments
67
67
def test_dslice_all_args (self ):
68
68
test_args = [
69
- {'username' :'new_username' },
69
+ {'username' : 'new_username' },
70
70
['password' ,
71
- 'host' ],
71
+ 'host' ],
72
72
'port'
73
73
]
74
74
expected = {
75
- 'new_username' :'admin' ,
76
- 'password' :'changeme' ,
77
- 'host' :'localhost' ,
78
- 'port' :8089
75
+ 'new_username' : 'admin' ,
76
+ 'password' : 'changeme' ,
77
+ 'host' : 'localhost' ,
78
+ 'port' : 8089
79
79
}
80
80
self .assertTrue (expected == dslice (TEST_DICT , * test_args ))
81
81
82
+
82
83
class FilePermissionTest (unittest .TestCase ):
83
84
84
85
def setUp (self ):
85
86
super (FilePermissionTest , self ).setUp ()
86
87
88
+ # Check for any change in the default file permission(i.e 644) for all files within splunklib
87
89
def test_filePermissions (self ):
88
90
89
91
def checkFilePermissions (dir_path ):
0 commit comments