def test_save_whitelist(self): try: os.makedirs(settings.WHITELIST_FILE.replace('whitelist', '')) except OSError: pass self.addCleanup(self.wipe_whitelist) self.assertEqual(save_whitelist({'a.b.c.d','e.f.g.h'}), None) self.assertEqual(load_whitelist(), {'a.b.c.d','e.f.g.h'})
def test_save_whitelist_rename_failure(self, rename): self.addCleanup(self.wipe_whitelist) rename.side_effect = OSError(errno.EPERM, 'Operation not permitted') with self.assertRaises(OSError): save_whitelist({'a.b.c.d','e.f.g.h'})