예제 #1
0
    def test_save_inexistent_file(self):
        document = Document()
        document.text = "this is only a test of save file"
        document.path = "test_file"

        document.save()

        self.assertTrue(os.path.exists(document.path))
        self.assertEquals("this is only a test of save file", document.text)
예제 #2
0
    def test_text_save_file(self):
        document = Document()
        document.text = "this is only a test of save file"
        document.path = "test_file"

        document.save()

        text_file = open(document.path, "r")
        self.assertEquals(document.text, text_file.read())
예제 #3
0
 def test_text_save_file(self):
     document = Document()
     document.text = "this is only a test of save file"
     document.path = "test_file"
     
     document.save()
     
     text_file = open(document.path, "r")
     self.assertEquals(document.text, text_file.read())
예제 #4
0
 def test_save_inexistent_file(self):
     document = Document()
     document.text = "this is only a test of save file"
     document.path = "test_file"
     
     document.save()
     
     self.assertTrue(os.path.exists(document.path))
     self.assertEquals("this is only a test of save file", document.text)
예제 #5
0
    def add_item_name_test(self):
        controller = DocumentListController()
        document = Document()
        document.path = "/path/to/test.tf"

        controller.add(document)
        item = controller.association.keys()[0]

        self.assertEquals("test.tf", item.text())
예제 #6
0
 def add_item_name2_test(self):
     controller = DocumentListController()
     
     document = Document()
     document.path = "/path/to/othertest.tf"
     
     controller.add(document)
     item = controller.association.keys()[0]
     
     self.assertEquals("othertest.tf", item.text())
예제 #7
0
    def change_filename_test(self):
        controller = DocumentListController()

        document = Document()
        document.path = "/path/to/othertest.tf"

        controller.add(document)
        item = controller.association.keys()[0]
        controller.change_filename(document, "/new/file/name.tf")

        self.assertEquals("name.tf", item.text())
예제 #8
0
 def change_filename_test(self):
     controller = DocumentListController()
     
     document = Document()
     document.path = "/path/to/othertest.tf"
     
     controller.add(document)
     item = controller.association.keys()[0]
     controller.change_filename(document, "/new/file/name.tf")
     
     self.assertEquals("name.tf", item.text())
예제 #9
0
    def test_replace_text_save_file(self):
        text_file = open("test_file", "w")
        text_file.write("this is only a test file")
        text_file.close()

        document = Document()
        document.text = "I changed the text"
        document.path = "test_file"

        document.save()

        text_file = open("test_file", "r")
        self.assertEquals(document.text, text_file.read())
예제 #10
0
 def test_replace_text_save_file(self):
     text_file = open("test_file", "w")
     text_file.write("this is only a test file")
     text_file.close()
     
     document = Document()
     document.text = "I changed the text"
     document.path = "test_file"
     
     document.save()
     
     text_file = open ("test_file", "r")
     self.assertEquals(document.text, text_file.read())