1616from __future__ import absolute_import
1717from __future__ import print_function
1818
19- import unittest2
20-
2119from splunklib .binding import HTTPError
2220
2321from tests import testlib
3028
3129import splunklib .client as client
3230
31+
3332def highest_port (service , base_port , * kinds ):
3433 """Find the first port >= base_port not in use by any input in kinds."""
3534 highest_port = base_port
@@ -38,6 +37,7 @@ def highest_port(service, base_port, *kinds):
3837 highest_port = max (port , highest_port )
3938 return highest_port
4039
40+
4141class TestTcpInputNameHandling (testlib .SDKTestCase ):
4242 def setUp (self ):
4343 super (TestTcpInputNameHandling , self ).setUp ()
@@ -116,6 +116,7 @@ def test_update_restrictToHost_fails(self):
116116 lambda : boris .update (restrictToHost = 'hilda' )
117117 )
118118
119+
119120class TestRead (testlib .SDKTestCase ):
120121 def test_read (self ):
121122 inputs = self .service .inputs
@@ -188,6 +189,7 @@ def test_oneshot_on_nonexistant_file(self):
188189 self .assertRaises (HTTPError ,
189190 self .service .inputs .oneshot , name )
190191
192+
191193class TestInput (testlib .SDKTestCase ):
192194 def setUp (self ):
193195 super (TestInput , self ).setUp ()
@@ -243,7 +245,6 @@ def test_lists_modular_inputs(self):
243245 input = inputs ['abcd' , 'test2' ]
244246 self .assertEqual (input .field1 , 'boris' )
245247
246-
247248 def test_create (self ):
248249 inputs = self .service .inputs
249250 for entity in six .itervalues (self ._test_entities ):
@@ -264,6 +265,13 @@ def test_read(self):
264265 self .assertEqual (this_entity .name , read_entity .name )
265266 self .assertEqual (this_entity .host , read_entity .host )
266267
268+ def test_read_indiviually (self ):
269+ tcp_input = self .service .input (self ._test_entities ['tcp' ].path ,
270+ self ._test_entities ['tcp' ].kind )
271+ self .assertIsNotNone (tcp_input )
272+ self .assertTrue ('tcp' , tcp_input .kind )
273+ self .assertTrue (self ._test_entities ['tcp' ].name , tcp_input .name )
274+
267275 def test_update (self ):
268276 inputs = self .service .inputs
269277 for entity in six .itervalues (self ._test_entities ):
@@ -273,7 +281,7 @@ def test_update(self):
273281 entity .refresh ()
274282 self .assertEqual (entity .host , kwargs ['host' ])
275283
276- @unittest2 .skip ('flaky' )
284+ @unittest .skip ('flaky' )
277285 def test_delete (self ):
278286 inputs = self .service .inputs
279287 remaining = len (self ._test_entities )- 1
0 commit comments