# Path: tests/testlib.py
# class NoRestartRequiredError(Exception):
# class WaitTimedOutError(Exception):
# class SDKTestCase(unittest.TestCase):
# def to_bool(x):
# def tmpname():
# def wait(predicate, timeout=60, pause_time=0.5):
#     def assertEventuallyTrue(self, predicate, timeout=30, pause_time=0.5,
#                              timeout_message="Operation timed out."):
#     def check_content(self, entity, **kwargs):
#     def check_entity(self, entity):
#     def clear_restart_message(self):
#     def fake_splunk_version(self, version):
#     def install_app_from_collection(self, name):
#     def app_collection_installed(self):
#     def pathInApp(self, appName, pathComponents):
#     def uncheckedRestartSplunk(self, timeout=240):
#     def restartSplunk(self, timeout=240):
#     def setUpClass(cls):
#     def setUp(self):
#     def tearDown(self):


import json
    import unittest
    import unittest2 as unittest
import splunklib.client as client
        import unittest2 as unittest
        import unittest
from tests import testlib
from splunklib.six.moves import range
        self.col = self.confs['test'].data

    def test_insert_query_delete_data(self):
        for x in range(50):
            self.col.insert(json.dumps({'_key': str(x), 'data': '#' + str(x), 'num': x}))
        self.assertEqual(len(self.col.query()), 50)
        self.assertEqual(len(self.col.query(query='{"num": 10}')), 1)
        self.assertEqual(self.col.query(query='{"num": 10}')[0]['data'], '#10')
        self.col.delete(json.dumps({'num': {'$gt': 39}}))
        self.assertEqual(len(self.col.query()), 40)
        self.col.delete()
        self.assertEqual(len(self.col.query()), 0)

    def test_update_delete_data(self):
        for x in range(50):
            self.col.insert(json.dumps({'_key': str(x), 'data': '#' + str(x), 'num': x}))
        self.assertEqual(len(self.col.query()), 50)
        self.assertEqual(self.col.query(query='{"num": 49}')[0]['data'], '#49')
        self.col.update(str(49), json.dumps({'data': '#50', 'num': 50}))
        self.assertEqual(len(self.col.query()), 50)
        self.assertEqual(self.col.query(query='{"num": 50}')[0]['data'], '#50')
        self.assertEqual(len(self.col.query(query='{"num": 49}')), 0)
        self.col.delete_by_id(49)
        self.assertEqual(len(self.col.query(query='{"num": 50}')), 0)

    def test_query_data(self):
        if ('test1' in self.confs):
            self.confs['test1'].delete()
        self.confs.create('test1')
        self.col = self.confs['test1'].data

# Path: tests/testlib.py
# class NoRestartRequiredError(Exception):
# class WaitTimedOutError(Exception):
# class SDKTestCase(unittest.TestCase):
# def to_bool(x):
# def tmpname():
# def wait(predicate, timeout=60, pause_time=0.5):
#     def assertEventuallyTrue(self, predicate, timeout=30, pause_time=0.5,
#                              timeout_message="Operation timed out."):
#     def check_content(self, entity, **kwargs):
#     def check_entity(self, entity):
#     def clear_restart_message(self):
#     def fake_splunk_version(self, version):
#     def install_app_from_collection(self, name):
#     def app_collection_installed(self):
#     def pathInApp(self, appName, pathComponents):
#     def uncheckedRestartSplunk(self, timeout=240):
#     def restartSplunk(self, timeout=240):
#     def setUpClass(cls):
#     def setUp(self):
#     def tearDown(self):


# Path: tests/test_kvstore_data.py
import json
    import unittest
    import unittest2 as unittest
import splunklib.client as client
        import unittest2 as unittest
        import unittest
from tests import testlib
from splunklib.six.moves import range

        self.col = self.confs['test'].data

    def test_insert_query_delete_data(self):
        for x in range(50):
            self.col.insert(json.dumps({'_key': str(x), 'data': '#' + str(x), 'num': x}))
        self.assertEqual(len(self.col.query()), 50)
        self.assertEqual(len(self.col.query(query='{"num": 10}')), 1)
        self.assertEqual(self.col.query(query='{"num": 10}')[0]['data'], '#10')
        self.col.delete(json.dumps({'num': {'$gt': 39}}))
        self.assertEqual(len(self.col.query()), 40)
        self.col.delete()
        self.assertEqual(len(self.col.query()), 0)

    def test_update_delete_data(self):
        for x in range(50):
            self.col.insert(json.dumps({'_key': str(x), 'data': '#' + str(x), 'num': x}))
        self.assertEqual(len(self.col.query()), 50)
        self.assertEqual(self.col.query(query='{"num": 49}')[0]['data'], '#49')
        self.col.update(str(49), json.dumps({'data': '#50', 'num': 50}))
        self.assertEqual(len(self.col.query()), 50)
        self.assertEqual(self.col.query(query='{"num": 50}')[0]['data'], '#50')
        self.assertEqual(len(self.col.query(query='{"num": 49}')), 0)
        self.col.delete_by_id(49)
        self.assertEqual(len(self.col.query(query='{"num": 50}')), 0)

    def test_query_data(self):
        if ('test1' in self.confs):
            self.confs['test1'].delete()
        self.confs.create('test1')
        self.col = self.confs['test1'].data

        for x in range(10):