@@ -44,29 +44,29 @@ def create_tcp_input(self, base_port, kind, **options):
4444 port = base_port
4545 while True : # Find the next unbound port
4646 try :
47- input = self .service .inputs .create (kind , str (port ), ** options )
47+ input = self .service .inputs .create (str (port ), kind , ** options )
4848 return input
4949 except client .HTTPError as he :
5050 if he .status == 400 :
5151 port += 1
5252
5353 def test_create_tcp_port (self ):
5454 for kind in ['tcp' , 'splunktcp' ]:
55- input = self .service .inputs .create (kind , str (self .base_port ))
55+ input = self .service .inputs .create (str (self .base_port ), kind )
5656 self .check_entity (input )
5757 input .delete ()
5858
5959 def test_cannot_create_with_restrictToHost_in_name (self ):
6060 self .assertRaises (
6161 client .HTTPError ,
62- lambda : self .service .inputs .create ('tcp ' , 'boris:10000 ' )
62+ lambda : self .service .inputs .create ('boris:10000 ' , 'tcp ' )
6363 )
6464
6565 def test_create_tcp_ports_with_restrictToHost (self ):
6666 for kind in ['tcp' , 'splunktcp' ]: # Multiplexed UDP ports are not supported
6767 # Make sure we can create two restricted inputs on the same port
68- boris = self .service .inputs .create (kind , str (self .base_port ), restrictToHost = 'boris' )
69- natasha = self .service .inputs .create (kind , str (self .base_port ), restrictToHost = 'natasha' )
68+ boris = self .service .inputs .create (str (self .base_port ), kind , restrictToHost = 'boris' )
69+ natasha = self .service .inputs .create (str (self .base_port ), kind , restrictToHost = 'natasha' )
7070 # And that they both function
7171 boris .refresh ()
7272 natasha .refresh ()
@@ -77,21 +77,21 @@ def test_create_tcp_ports_with_restrictToHost(self):
7777
7878 def test_restricted_to_unrestricted_collision (self ):
7979 for kind in ['tcp' , 'splunktcp' , 'udp' ]:
80- restricted = self .service .inputs .create (kind , str (self .base_port ), restrictToHost = 'boris' )
80+ restricted = self .service .inputs .create (str (self .base_port ), kind , restrictToHost = 'boris' )
8181 self .assertTrue ('boris:' + str (self .base_port ) in self .service .inputs )
8282 self .assertRaises (
8383 client .HTTPError ,
84- lambda : self .service .inputs .create (kind , str (self .base_port ))
84+ lambda : self .service .inputs .create (str (self .base_port ), kind )
8585 )
8686 restricted .delete ()
8787
8888 def test_unrestricted_to_restricted_collision (self ):
8989 for kind in ['tcp' , 'splunktcp' , 'udp' ]:
90- unrestricted = self .service .inputs .create (kind , str (self .base_port ))
90+ unrestricted = self .service .inputs .create (str (self .base_port ), kind )
9191 self .assertTrue (str (self .base_port ) in self .service .inputs )
9292 self .assertRaises (
9393 client .HTTPError ,
94- lambda : self .service .inputs .create (kind , str (self .base_port ), restrictToHost = 'boris' )
94+ lambda : self .service .inputs .create (str (self .base_port ), kind , restrictToHost = 'boris' )
9595 )
9696 unrestricted .delete ()
9797
@@ -177,11 +177,11 @@ def setUp(self):
177177 self ._test_entities = {}
178178
179179 self ._test_entities ['tcp' ] = \
180- inputs .create ('tcp' , unrestricted_port , host = 'sdk-test' )
180+ inputs .create (unrestricted_port , 'tcp' , host = 'sdk-test' )
181181 self ._test_entities ['udp' ] = \
182- inputs .create ('udp' , unrestricted_port , host = 'sdk-test' )
182+ inputs .create (unrestricted_port , 'udp' , host = 'sdk-test' )
183183 self ._test_entities ['restrictedTcp' ] = \
184- inputs .create ('tcp' , restricted_port , restrictToHost = 'boris' )
184+ inputs .create (restricted_port , 'tcp' , restrictToHost = 'boris' )
185185
186186 def tearDown (self ):
187187 super (TestInput , self ).tearDown ()
@@ -210,10 +210,10 @@ def test_lists_modular_inputs(self):
210210 self .uncheckedRestartSplunk ()
211211
212212 inputs = self .service .inputs
213- if ('test2 ' ,'abcd ' ) not in inputs :
214- inputs .create ('test2 ' , 'abcd ' , field1 = 'boris' )
213+ if ('abcd ' ,'test2 ' ) not in inputs :
214+ inputs .create ('abcd ' , 'test2 ' , field1 = 'boris' )
215215
216- input = inputs ['test2 ' , 'abcd ' ]
216+ input = inputs ['abcd ' , 'test2 ' ]
217217 self .assertEqual (input .field1 , 'boris' )
218218
219219
@@ -232,7 +232,7 @@ def test_read(self):
232232 inputs = self .service .inputs
233233 for this_entity in self ._test_entities .itervalues ():
234234 kind , name = this_entity .kind , this_entity .name
235- read_entity = inputs [kind , name ]
235+ read_entity = inputs [name , kind ]
236236 self .assertEqual (this_entity .kind , read_entity .kind )
237237 self .assertEqual (this_entity .name , read_entity .name )
238238 self .assertEqual (this_entity .host , read_entity .host )
@@ -253,16 +253,16 @@ def test_delete(self):
253253 name = input_entity .name
254254 kind = input_entity .kind
255255 self .assertTrue (name in inputs )
256- self .assertTrue ((kind , name ) in inputs )
256+ self .assertTrue ((name , kind ) in inputs )
257257 if remaining == 0 :
258258 inputs .delete (name )
259259 self .assertFalse (name in inputs )
260260 else :
261261 if not name .startswith ('boris' ):
262262 self .assertRaises (client .AmbiguousReferenceException ,
263263 inputs .delete , name )
264- self .service .inputs .delete (kind , name )
265- self .assertFalse ((kind , name ) in inputs )
264+ self .service .inputs .delete (name , kind )
265+ self .assertFalse ((name , kind ) in inputs )
266266 self .assertRaises (client .HTTPError ,
267267 input_entity .refresh )
268268 remaining -= 1
0 commit comments