# 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
        # 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)
        username = random_string(20)
        service = random_string(20)
        self.check_set_get(service, username, password)

    def test_difficult_chars(self):
        password = random_string(20, DIFFICULT_CHARS)
        username = random_string(20, DIFFICULT_CHARS)
        service = random_string(20, DIFFICULT_CHARS)
        self.check_set_get(service, username, password)

    def test_delete_present(self):
        password = random_string(20, DIFFICULT_CHARS)
        username = random_string(20, DIFFICULT_CHARS)
        service = random_string(20, DIFFICULT_CHARS)
        self.keyring.set_password(service, username, password)
        self.keyring.delete_password(service, username)
        self.assertIsNone(self.keyring.get_password(service, username))

    def test_delete_not_present(self):
        username = random_string(20, DIFFICULT_CHARS)

# 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

        # 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)
        username = random_string(20)
        service = random_string(20)
        self.check_set_get(service, username, password)

    def test_difficult_chars(self):
        password = random_string(20, DIFFICULT_CHARS)
        username = random_string(20, DIFFICULT_CHARS)
        service = random_string(20, DIFFICULT_CHARS)
        self.check_set_get(service, username, password)

    def test_delete_present(self):
        password = random_string(20, DIFFICULT_CHARS)
        username = random_string(20, DIFFICULT_CHARS)
        service = random_string(20, DIFFICULT_CHARS)
        self.keyring.set_password(service, username, password)
        self.keyring.delete_password(service, username)
        self.assertIsNone(self.keyring.get_password(service, username))

    def test_delete_not_present(self):
        username = random_string(20, DIFFICULT_CHARS)

        service = random_string(20, DIFFICULT_CHARS)