# 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
import logging
import splunklib.client as client
        import unittest2 as unittest
        import unittest
        # Prepends one escaped slash
        p = self.storage_passwords.create("changeme", username, realm)
        self.assertEqual(start_count + 1, len(self.storage_passwords))
        self.assertEqual(p.realm, realm)
        # Prepends one escaped slash
        self.assertEqual(p.username, username)
        # self.assertEqual(p.clear_password, "changeme")
        # Checks for 2 escaped slashes (Splunk encodes the single slash)
        self.assertEqual(p.name, realm + ":" + username + ":")

        p.delete()
        self.assertEqual(start_count, len(self.storage_passwords))

    def test_create_norealm(self):
        start_count = len(self.storage_passwords)
        username = testlib.tmpname()

        p = self.storage_passwords.create("changeme", username)
        self.assertEqual(start_count + 1, len(self.storage_passwords))
        self.assertEqual(p.realm, None)
        self.assertEqual(p.username, username)
        # self.assertEqual(p.clear_password, "changeme")
        self.assertEqual(p.name, ":" + username + ":")

        p.delete()
        self.assertEqual(start_count, len(self.storage_passwords))

    def test_create_with_colons(self):
        start_count = len(self.storage_passwords)
        username = testlib.tmpname()

# 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_storage_passwords.py
from tests import testlib
import logging
import splunklib.client as client
        import unittest2 as unittest
        import unittest

        # Prepends one escaped slash
        p = self.storage_passwords.create("changeme", username, realm)
        self.assertEqual(start_count + 1, len(self.storage_passwords))
        self.assertEqual(p.realm, realm)
        # Prepends one escaped slash
        self.assertEqual(p.username, username)
        # self.assertEqual(p.clear_password, "changeme")
        # Checks for 2 escaped slashes (Splunk encodes the single slash)
        self.assertEqual(p.name, realm + ":" + username + ":")

        p.delete()
        self.assertEqual(start_count, len(self.storage_passwords))

    def test_create_norealm(self):
        start_count = len(self.storage_passwords)
        username = testlib.tmpname()

        p = self.storage_passwords.create("changeme", username)
        self.assertEqual(start_count + 1, len(self.storage_passwords))
        self.assertEqual(p.realm, None)
        self.assertEqual(p.username, username)
        # self.assertEqual(p.clear_password, "changeme")
        self.assertEqual(p.name, ":" + username + ":")

        p.delete()
        self.assertEqual(start_count, len(self.storage_passwords))

    def test_create_with_colons(self):
        start_count = len(self.storage_passwords)
        username = testlib.tmpname()

        realm = testlib.tmpname()