def test_add_and_remove_internet_password(self): import uuid k = Keychain() kwargs = { 'server_name': "pymacadmin.googlecode.com", 'account_name': "unittest", 'protocol_type': 'http', 'authentication_type': 'http', 'password': str(uuid.uuid4()) } i = InternetPassword(**kwargs) k.add(i) self.assertEquals( i.password, k.find_internet_password( server_name=kwargs['server_name'], account_name=kwargs['account_name']).password) k.remove(i) self.assertRaises( KeyError, k.find_internet_password, **{ "server_name": kwargs['server_name'], "account_name": kwargs['account_name'] })
def test_add_and_remove_internet_password(self): import uuid k = Keychain() kwargs = { "server_name": "pymacadmin.googlecode.com", "account_name": "unittest", "protocol_type": "http", "authentication_type": "http", "password": str(uuid.uuid4()), } i = InternetPassword(**kwargs) k.add(i) self.assertEquals( i.password, k.find_internet_password(server_name=kwargs["server_name"], account_name=kwargs["account_name"]).password, ) k.remove(i) self.assertRaises( KeyError, k.find_internet_password, **{"server_name": kwargs["server_name"], "account_name": kwargs["account_name"]} )
def test_add_and_remove_generic_password(self): import uuid k = Keychain() service_name = "PyMacAdmin Keychain Unit Test" account_name = str(uuid.uuid4()) password = str(uuid.uuid4()) i = GenericPassword(service_name=service_name, account_name=account_name, password=password) k.add(i) self.assertEquals(i.password, k.find_generic_password(service_name, account_name).password) k.remove(i) self.assertRaises(KeyError, k.find_generic_password, **{"service_name": service_name, "account_name": account_name})
def test_add_and_remove_generic_password(self): import uuid k = Keychain() service_name = "PyMacAdmin Keychain Unit Test" account_name = str(uuid.uuid4()) password = str(uuid.uuid4()) i = GenericPassword(service_name=service_name, account_name=account_name, password=password) k.add(i) self.assertEquals( i.password, k.find_generic_password(service_name, account_name).password) k.remove(i) self.assertRaises( KeyError, k.find_generic_password, **{ "service_name": service_name, "account_name": account_name })