# Path: resources/lib/PhoneBooks/pyicloud/vendorlibs/keyring/tests/util.py
# def random_string(k, source = ALPHABET):
#     """Generate a random string with length <i>k</i>
#     """
#     result = ''
#     for i in range(0, k):
#         result += random.choice(source)
#     return result


import string
from keyring.util import escape
from .util import random_string
from keyring import errors

    def setUp(self):
        self.keyring = self.init_keyring()
        self.credentials_created = set()

    def tearDown(self):
        for item in self.credentials_created:
            self.keyring.delete_password(*item)

    def set_password(self, service, username, password):
        # set the password and save the result so the test runner can clean
        #  up after if necessary.
        self.keyring.set_password(service, username, password)
        self.credentials_created.add((service, username))

    def check_set_get(self, service, username, password):
        keyring = self.keyring

        # for the non-existent password
        self.assertEqual(keyring.get_password(service, username), None)

        # common usage
        self.set_password(service, username, password)
        self.assertEqual(keyring.get_password(service, username), password)

        # for the empty password
        self.set_password(service, username, "")
        self.assertEqual(keyring.get_password(service, username), "")

    def test_password_set_get(self):

# Path: resources/lib/PhoneBooks/pyicloud/vendorlibs/keyring/tests/util.py
# def random_string(k, source = ALPHABET):
#     """Generate a random string with length <i>k</i>
#     """
#     result = ''
#     for i in range(0, k):
#         result += random.choice(source)
#     return result


# Path: resources/lib/PhoneBooks/pyicloud/vendorlibs/keyring/tests/test_backend.py
import string
from keyring.util import escape
from .util import random_string
from keyring import errors


    def setUp(self):
        self.keyring = self.init_keyring()
        self.credentials_created = set()

    def tearDown(self):
        for item in self.credentials_created:
            self.keyring.delete_password(*item)

    def set_password(self, service, username, password):
        # set the password and save the result so the test runner can clean
        #  up after if necessary.
        self.keyring.set_password(service, username, password)
        self.credentials_created.add((service, username))

    def check_set_get(self, service, username, password):
        keyring = self.keyring

        # for the non-existent password
        self.assertEqual(keyring.get_password(service, username), None)

        # common usage
        self.set_password(service, username, password)
        self.assertEqual(keyring.get_password(service, username), password)

        # for the empty password
        self.set_password(service, username, "")
        self.assertEqual(keyring.get_password(service, username), "")

    def test_password_set_get(self):

        password = random_string(20)