def test_save_fast_resume_data_bad(self): # Grab the filename that will be used filename = generate_fast_resume_filename(FAKE_INFO_HASH) # Create the file os.makedirs(os.path.dirname(filename)) f = open(filename, 'wb') f.close() os.chmod(filename, 0) save_fast_resume_data(FAKE_INFO_HASH, FAKE_RESUME_DATA) # We did not lock down the directory so check save_fast_resume_data # nuked the file for us. self.assertFalse(os.path.exists(filename))
def test_resume_data(self): save_fast_resume_data(FAKE_INFO_HASH, FAKE_RESUME_DATA) data = load_fast_resume_data(FAKE_INFO_HASH) self.assertEquals(FAKE_RESUME_DATA, data)