def test_save_bad_filename(self): # TODO: get make_protected_dir() to work on Windows. if sys.platform == 'win32': raise nose.SkipTest() c1 = Container() directory = make_protected_dir() path = os.path.join(directory, 'illegal') try: c1.save(path) except IOError, exc: msg = ": Can't save to '%s': Permission denied" % path self.assertEqual(str(exc), msg)
def test_save_bad_destination(self): logging.debug('') logging.debug('test_save_bad_destination') # TODO: get make_protected_dir() to work on Windows. if sys.platform == 'win32': raise nose.SkipTest() directory = make_protected_dir() try: # Attempt to save to directory we aren't allowed to write to. self.model.save_to_egg(self.model.name, next_egg(), py_dir=PY_DIR, dst_dir=directory) except IOError, exc: self.assertTrue('no write permission' in str(exc) or 'Permission denied' in str(exc))