def test_forgetting_services(self): """Are services correctly forgotten? Technically, this means "never saved." Chances are good my fake service names won't ever be real services, so unless somebody's trying to outsmart the test, there's nothing to worry about. """ url = "sharky_with_angry_hats" service = "omg its a fake service name, haha." gpg_to_use = gnupg.GPG(gnupghome='../data/test_gpg_home') options = OptionParser() options.config = "../data/test.cfg" (keyid, lang, protocols, connectors) = santiago_test.load_config( options) listeners, senders, monitors = santiago_test.configure_connectors( protocols, connectors) hosting = { keyid: { service: [url] } } consuming = { keyid: { service: [url] } } freedombuddy = santiago.Santiago(hosting=hosting, consuming=consuming, save_services=False, me=keyid, gpg=gpg_to_use) freedombuddy1 = santiago.Santiago(me=keyid, gpg=gpg_to_use) self.cycle(freedombuddy) self.cycle(freedombuddy1) self.assertNotIn(service, freedombuddy1.hosting) self.assertNotIn(service, freedombuddy1.consuming)
def test_saving_services(self): """Are services correctly saved?""" url = "sharky_with_angry_hats" service = "omg its a fake service name, haha." gpg_to_use = gnupg.GPG(gnupghome='../data/test_gpg_home') options = OptionParser() options.config = "../data/test.cfg" (keyid, lang, protocols, connectors) = santiago_test.load_config( options) listeners, senders, monitors = santiago_test.configure_connectors( protocols, connectors) hosting = { keyid: { service: [url] } } consuming = { keyid: { service: [url] } } freedombuddy = santiago.Santiago(hosting=hosting, consuming=consuming, save_dir='../data/test_gpg_home', me=keyid, gpg=gpg_to_use) self.cycle(freedombuddy) freedombuddy1 = santiago.Santiago(me=keyid, gpg=gpg_to_use, save_dir='../data/test_gpg_home') self.assertIn(service, freedombuddy1.hosting[keyid]) self.assertIn(service, freedombuddy1.consuming[keyid])