def setUp(self): self.dummy_article_doc_id = '9191919191' self.dummy_fd = File(self.dummy_article_doc_id, 'a', 'w') self.dummy_fd.write(u'#title my migration note to ubuntu 12.04\n#author\n#dalsoo\n#date 1401152021\n\naaaaa') self.dummy_filename = self.dummy_fd.filename self.dummy_lock_filename = self.dummy_fd.lock_filename self.dummy_backup_filename = self.dummy_fd.backup_filename self.dummy_fd.close() self.assertTrue(ope(self.dummy_filename)) self.assertEqual(self.dummy_fd.filename, 7926)
def test_write_article(self): dummy_doc_id = '9191919191' file = File(dummy_doc_id, 'a', 'w') file.write(u'aaa') file.close() file_read = File(dummy_doc_id, 'a', 'r') content = file_read.read() self.assertEqual(content, u'aaa') self.removeFiles(file) self.fileNotExistsp(file)