16
16
from __future__ import absolute_import
17
17
from __future__ import print_function
18
18
19
- import unittest2
20
-
21
19
from splunklib .binding import HTTPError
22
20
23
21
from tests import testlib
30
28
31
29
import splunklib .client as client
32
30
31
+
33
32
def highest_port (service , base_port , * kinds ):
34
33
"""Find the first port >= base_port not in use by any input in kinds."""
35
34
highest_port = base_port
@@ -38,6 +37,7 @@ def highest_port(service, base_port, *kinds):
38
37
highest_port = max (port , highest_port )
39
38
return highest_port
40
39
40
+
41
41
class TestTcpInputNameHandling (testlib .SDKTestCase ):
42
42
def setUp (self ):
43
43
super (TestTcpInputNameHandling , self ).setUp ()
@@ -116,6 +116,7 @@ def test_update_restrictToHost_fails(self):
116
116
lambda : boris .update (restrictToHost = 'hilda' )
117
117
)
118
118
119
+
119
120
class TestRead (testlib .SDKTestCase ):
120
121
def test_read (self ):
121
122
inputs = self .service .inputs
@@ -188,6 +189,7 @@ def test_oneshot_on_nonexistant_file(self):
188
189
self .assertRaises (HTTPError ,
189
190
self .service .inputs .oneshot , name )
190
191
192
+
191
193
class TestInput (testlib .SDKTestCase ):
192
194
def setUp (self ):
193
195
super (TestInput , self ).setUp ()
@@ -243,7 +245,6 @@ def test_lists_modular_inputs(self):
243
245
input = inputs ['abcd' , 'test2' ]
244
246
self .assertEqual (input .field1 , 'boris' )
245
247
246
-
247
248
def test_create (self ):
248
249
inputs = self .service .inputs
249
250
for entity in six .itervalues (self ._test_entities ):
@@ -264,6 +265,13 @@ def test_read(self):
264
265
self .assertEqual (this_entity .name , read_entity .name )
265
266
self .assertEqual (this_entity .host , read_entity .host )
266
267
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
+
267
275
def test_update (self ):
268
276
inputs = self .service .inputs
269
277
for entity in six .itervalues (self ._test_entities ):
@@ -273,7 +281,7 @@ def test_update(self):
273
281
entity .refresh ()
274
282
self .assertEqual (entity .host , kwargs ['host' ])
275
283
276
- @unittest2 .skip ('flaky' )
284
+ @unittest .skip ('flaky' )
277
285
def test_delete (self ):
278
286
inputs = self .service .inputs
279
287
remaining = len (self ._test_entities )- 1
0 commit comments