def setUp(self): self.opts = testlib.parse([], {}, ".splunkrc") self.service = client.Service(**self.opts.kwargs) # Skip these tests if running below Splunk 6.2, cookie-auth didn't exist before splver = self.service.splunk_version if splver[:2] < (6, 2): self.skipTest("Skipping cookie-auth tests, running in %d.%d.%d, this feature was added in 6.2+" % splver)
def setUp(self): self.opts = testlib.parse([], {}, ".splunkrc") self.service = client.Service(**self.opts.kwargs) # Skip these tests if running below Splunk 6.2, cookie-auth didn't exist before splver = self.service.splunk_version # TODO: Workaround the fact that skipTest is not defined by unittest2.TestCase if splver[:2] < (6, 2): self.skipTest("Skipping cookie-auth tests, running in %d.%d.%d, this feature was added in 6.2+" % splver)
def setUp(self): self.opts = testlib.parse([], {}, ".splunkrc") self.service = client.Service(**self.opts.kwargs) # Skip these tests if running below Splunk 6.2, cookie-auth didn't exist before splver = self.service.splunk_version if splver[:2] < (6, 2): self.skipTest( "Skipping cookie-auth tests, running in %d.%d.%d, this feature was added in 6.2+" % splver)
def setUp(self): self.opts = testlib.parse([], {}, ".splunkrc") opts = self.opts.kwargs.copy() opts["basic"] = True opts["username"] = self.opts.kwargs["username"] opts["password"] = self.opts.kwargs["password"] self.context = binding.connect(**opts) import splunklib.client as client service = client.Service(**opts)
def setUp(self): self.opts = testlib.parse([], {}, ".splunkrc") self.service = client.Service(**self.opts.kwargs) # Skip these tests if running below Splunk 6.2, cookie-auth didn't exist before splver = self.service.splunk_version # TODO: Workaround the fact that skipTest is not defined by unittest2.TestCase if splver[:2] < (6, 2): self.skipTest( "Skipping cookie-auth tests, running in %d.%d.%d, this feature was added in 6.2+" % splver)
def test_from_and_to_tuple_03(self): """Asserts equality of conversion from parsed parsetree back to tuple for whole library.""" for py in python_library(): sys.stdout.write('{}...'.format(py)) pt = parse(py) root = parsetree.fromtuple(pt) leaves = root.leaves self.assertTupleEqual(pt, root.totuple()) self.assertAllTrue([isinstance(n, TerminalNode) for n in leaves]) self.assertAllTrue([isinstance(n, str) for n in leaves]) print('PASS')
def test_traversal_library(self): """Tests equivalent traversal behaviour for all files in library.""" for py in python_library(): sys.stdout.write('{}...'.format(py)) pt = parse(py) root = parsetree.fromtuple(pt) tuple_iter = tupletraversal.preorder(pt) node_iter = root.preorder() for t, n in zip(tuple_iter, node_iter): self.assertEqual(t, n) print('PASS')
def setUp(self): logging.info("%s", self.__class__.__name__) self.opts = testlib.parse([], {}, ".splunkrc") self.context = binding.connect(**self.opts.kwargs) logging.debug("Connected to splunkd.")