@@ -36,13 +36,13 @@ def test_capabilities(self):
3636 capabilities = self .service .capabilities
3737 self .assertTrue (isinstance (capabilities , list ))
3838 self .assertTrue (all ([isinstance (c , str ) for c in capabilities ]))
39- self .assertTrue ('change_own_password' in capabilities ) # This should always be there...
39+ self .assertTrue ('change_own_password' in capabilities ) # This should always be there...
4040
4141 def test_info (self ):
4242 info = self .service .info
4343 keys = ["build" , "cpu_arch" , "guid" , "isFree" , "isTrial" , "licenseKeys" ,
44- "licenseSignature" , "licenseState" , "master_guid" , "mode" ,
45- "os_build" , "os_name" , "os_version" , "serverName" , "version" ]
44+ "licenseSignature" , "licenseState" , "master_guid" , "mode" ,
45+ "os_build" , "os_name" , "os_version" , "serverName" , "version" ]
4646 for key in keys :
4747 self .assertTrue (key in list (info .keys ()))
4848
@@ -74,25 +74,25 @@ def test_app_namespace(self):
7474
7575 def test_owner_wildcard (self ):
7676 kwargs = self .opts .kwargs .copy ()
77- kwargs .update ({ 'app' : "search" , 'owner' : "-" })
77+ kwargs .update ({'app' : "search" , 'owner' : "-" })
7878 service_ns = client .connect (** kwargs )
7979 service_ns .apps .list ()
8080
8181 def test_default_app (self ):
8282 kwargs = self .opts .kwargs .copy ()
83- kwargs .update ({ 'app' : None , 'owner' : "admin" })
83+ kwargs .update ({'app' : None , 'owner' : "admin" })
8484 service_ns = client .connect (** kwargs )
8585 service_ns .apps .list ()
8686
8787 def test_app_wildcard (self ):
8888 kwargs = self .opts .kwargs .copy ()
89- kwargs .update ({ 'app' : "-" , 'owner' : "admin" })
89+ kwargs .update ({'app' : "-" , 'owner' : "admin" })
9090 service_ns = client .connect (** kwargs )
9191 service_ns .apps .list ()
9292
9393 def test_user_namespace (self ):
9494 kwargs = self .opts .kwargs .copy ()
95- kwargs .update ({ 'app' : "search" , 'owner' : "admin" })
95+ kwargs .update ({'app' : "search" , 'owner' : "admin" })
9696 service_ns = client .connect (** kwargs )
9797 service_ns .apps .list ()
9898
@@ -114,7 +114,7 @@ def test_parse_fail(self):
114114 def test_restart (self ):
115115 service = client .connect (** self .opts .kwargs )
116116 self .service .restart (timeout = 300 )
117- service .login () # Make sure we are awake
117+ service .login () # Make sure we are awake
118118
119119 def test_read_outputs_with_type (self ):
120120 name = testlib .tmpname ()
@@ -138,7 +138,7 @@ def test_splunk_version(self):
138138 for p in v :
139139 self .assertTrue (isinstance (p , int ) and p >= 0 )
140140
141- for version in [(4 ,3 , 3 ), (5 ,), (5 ,0 , 1 )]:
141+ for version in [(4 , 3 , 3 ), (5 ,), (5 , 0 , 1 )]:
142142 with self .fake_splunk_version (version ):
143143 self .assertEqual (version , self .service .splunk_version )
144144
@@ -167,15 +167,15 @@ def _create_unauthenticated_service(self):
167167 'scheme' : self .opts .kwargs ['scheme' ]
168168 })
169169
170- #To check the HEC event endpoint using Endpoint instance
170+ # To check the HEC event endpoint using Endpoint instance
171171 def test_hec_event (self ):
172172 import json
173173 service_hec = client .connect (host = 'localhost' , scheme = 'https' , port = 8088 ,
174174 token = "11111111-1111-1111-1111-1111111111113" )
175175 event_collector_endpoint = client .Endpoint (service_hec , "/services/collector/event" )
176176 msg = {"index" : "main" , "event" : "Hello World" }
177177 response = event_collector_endpoint .post ("" , body = json .dumps (msg ))
178- self .assertEqual (response .status ,200 )
178+ self .assertEqual (response .status , 200 )
179179
180180
181181class TestCookieAuthentication (unittest .TestCase ):
@@ -287,6 +287,7 @@ def test_login_with_multiple_cookies(self):
287287 service2 .login ()
288288 self .assertEqual (service2 .apps .get ().status , 200 )
289289
290+
290291class TestSettings (testlib .SDKTestCase ):
291292 def test_read_settings (self ):
292293 settings = self .service .settings
@@ -316,6 +317,7 @@ def test_update_settings(self):
316317 self .assertEqual (updated , original )
317318 self .restartSplunk ()
318319
320+
319321class TestTrailing (unittest .TestCase ):
320322 template = '/servicesNS/boris/search/another/path/segment/that runs on'
321323
@@ -329,19 +331,21 @@ def test_no_args_is_identity(self):
329331 self .assertEqual (self .template , client ._trailing (self .template ))
330332
331333 def test_trailing_with_one_arg_works (self ):
332- self .assertEqual ('boris/search/another/path/segment/that runs on' , client ._trailing (self .template , 'ervicesNS/' ))
334+ self .assertEqual ('boris/search/another/path/segment/that runs on' ,
335+ client ._trailing (self .template , 'ervicesNS/' ))
333336
334337 def test_trailing_with_n_args_works (self ):
335338 self .assertEqual (
336339 'another/path/segment/that runs on' ,
337340 client ._trailing (self .template , 'servicesNS/' , '/' , '/' )
338341 )
339342
343+
340344class TestEntityNamespacing (testlib .SDKTestCase ):
341345 def test_proper_namespace_with_arguments (self ):
342346 entity = self .service .apps ['search' ]
343- self .assertEqual ((None ,None ,"global" ), entity ._proper_namespace (sharing = "global" ))
344- self .assertEqual ((None ,"search" ,"app" ), entity ._proper_namespace (sharing = "app" , app = "search" ))
347+ self .assertEqual ((None , None , "global" ), entity ._proper_namespace (sharing = "global" ))
348+ self .assertEqual ((None , "search" , "app" ), entity ._proper_namespace (sharing = "app" , app = "search" ))
345349 self .assertEqual (
346350 ("admin" , "search" , "user" ),
347351 entity ._proper_namespace (sharing = "user" , app = "search" , owner = "admin" )
@@ -360,6 +364,7 @@ def test_proper_namespace_with_service_namespace(self):
360364 self .service .namespace .sharing )
361365 self .assertEqual (namespace , entity ._proper_namespace ())
362366
367+
363368if __name__ == "__main__" :
364369 try :
365370 import unittest2 as unittest
0 commit comments