# 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):


from tests import testlib
from contextlib import contextmanager
from splunklib.six.moves import range
        from splunklib.binding import namespace
import logging
import splunklib.client as client
        import random
        import unittest2 as unittest
        import unittest
                found.append(ent.name)
            self.assertEqual(expected, found,
                             msg='on %s (expected: %s, found: %s)' % \
                                 (coll_name, expected, found))

    def test_paging(self):
        for coll_name in collections:
            coll = getattr(self.service, coll_name)
            expected = [ent.name for ent in coll.list(count=30)]
            if len(expected) == 0:
                logging.debug("No entities in collection %s; skipping test.", coll_name)
            total = len(expected)
            page_size = max(int(total/5.0), 1)
            found = []
            offset = 0
            while offset < total:
                page = coll.list(offset=offset, count=page_size)
                count = len(page)
                offset += count
                self.assertTrue(count == page_size or offset == total,
                                msg='on %s' % coll_name)
                found.extend([ent.name for ent in page])
                logging.debug("Iterate: offset=%d/%d", offset, total)
            self.assertEqual(expected, found,
                             msg='on %s (expected: %s, found: %s)' % \
                                 (coll_name, expected, found))

    def test_getitem_with_nonsense(self):
        for coll_name in collections:
            coll = getattr(self.service, coll_name)

# 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_collection.py
from tests import testlib
from contextlib import contextmanager
from splunklib.six.moves import range
        from splunklib.binding import namespace
import logging
import splunklib.client as client
        import random
        import unittest2 as unittest
        import unittest

                found.append(ent.name)
            self.assertEqual(expected, found,
                             msg='on %s (expected: %s, found: %s)' % \
                                 (coll_name, expected, found))

    def test_paging(self):
        for coll_name in collections:
            coll = getattr(self.service, coll_name)
            expected = [ent.name for ent in coll.list(count=30)]
            if len(expected) == 0:
                logging.debug("No entities in collection %s; skipping test.", coll_name)
            total = len(expected)
            page_size = max(int(total/5.0), 1)
            found = []
            offset = 0
            while offset < total:
                page = coll.list(offset=offset, count=page_size)
                count = len(page)
                offset += count
                self.assertTrue(count == page_size or offset == total,
                                msg='on %s' % coll_name)
                found.extend([ent.name for ent in page])
                logging.debug("Iterate: offset=%d/%d", offset, total)
            self.assertEqual(expected, found,
                             msg='on %s (expected: %s, found: %s)' % \
                                 (coll_name, expected, found))

    def test_getitem_with_nonsense(self):
        for coll_name in collections:
            coll = getattr(self.service, coll_name)

            name = testlib.tmpname()