예제 #1
0
    def test_read_opend_file(self):
        file = "normal.vok"
        lection = Vokker()
        lection.open(file)

        rt = lection.read()
        self.assertTrue(rt)
        lection.close
예제 #2
0
    def test_create_new_datafile(self):
        datafile = 'test.vok'
        lection = Vokker()

        bo = lection.open(datafile)
        self.assertTrue(bo)

        lection.close()
예제 #3
0
    def test_read_FAIL_wrong_header(self):
        file = "wrong_header.vok"
        lection = Vokker()
        lection.open(file)

        rt = lection.read()
        lection.close()
        self.assertFalse(False)
예제 #4
0
    def test_read_FALSE_wrong_datastructur(self):
        file = "wrong_datastructur.vok"
        lection = Vokker()
        lection.open(file)

        rt = lection.read()
        self.assertFalse(rt)
        lection.close()
예제 #5
0
class MyTestCase(unittest.TestCase):
    vokker = Vokker()

    def test_console_shows_menue(self):
        self.vokker.open(None)
        self.vokker.read()

        cons = VokkerConsole(self.vokker)
        cons.show_menu()

    def test_input_command_to_read_file(self):
예제 #6
0
 def test_open_FAIL_if_vok_new_data_not_empty(self):
     datafile = 'test.vok'
     lec = Vokker()
     lec._vok_new_data = ""
     rt = lec.open(datafile)
     self.assertFalse(rt, "still unsaved data in new_data")
     lec.close()
예제 #7
0
    def test_open_FAIL_if_safelock_is_true(self):
        datafile = 'test.vok'
        lec = Vokker()
        lec._safelock = True
        rt = lec.open(datafile)

        self.assertFalse(rt, "File opened, but safelock is True")
        lec.close()
예제 #8
0
 def test_close_FAIL_if_safelock_is_true(self):
     datafile = 'test.vok'
     lection = Vokker()
     lection.open(datafile)
     lection._safelock = True
     rt = lection.close()
     self.assertFalse(rt, "safelock is activ")
     lection._file_handle.close()
예제 #9
0
    def test_close_FAIL_if_vok_new_data_not_empty(self):
        datafile = 'test.vok'
        lection = Vokker()
        lection.open(datafile)
        lection._vok_new_data = dict()
        lection._vok_new_data['Auto'] = 'car'

        rt = lection._file_handle.close()
        self.assertFalse(rt, "still unsaved data in new_data")
예제 #10
0
    def test_read_normal_file(self):
        datafile = 'normal.vok'
        lection = Vokker()
        lection.open(datafile)
        lection.read()

        compartion_dict = {
            "Auto": "car",
            "Baum": "tree",
            "empfohlen": "recommend",
            "Ein Auto": "a car"
        }
        boo = bool(compartion_dict == lection.get_vok_dict())
        self.assertTrue(boo)

        lection._file_handle.close()
예제 #11
0
 def test_fileexist_FAIL_non_existing_file(self):
     file = "non_existin_file.vok.vok"
     lec = Vokker()
     rt = lec.fileexist(file)
     self.assertFalse(rt)
예제 #12
0
 def test_fileexist(self):
     file = "normal.vok"
     lec = Vokker()
     rt = lec.fileexist(file)
     self.assertTrue(rt)
예제 #13
0
 def test_init_instance(self):
     lection = Vokker()
     self.assertIsInstance(lection, Vokker)
예제 #14
0
 def test_close_FAIL_if_non_opened_file(self):
     l = Vokker()
     l._safelock = True
     rt = l.close()
     self.assertFalse(rt, "unable to close non-opened file!!! ")
예제 #15
0
 def test_read_FAIL_not_opend_file(self):
     lection = Vokker()
     rt = lection.read()
     self.assertFalse(rt)
예제 #16
0
 def test_open_FAIL_nonexistent_file_failed(self):
     datafile = 'not_existing_file.vok'
     lection = Vokker()
     rt = lection.open(datafile)
     self.assertFalse(rt, 'try to open a non existing file!!!')
예제 #17
0
 def test_open_existing_file(self):
     datafile = 'test.vok'
     lection = Vokker()
     rt = lection.open(datafile)
     self.assertTrue(rt)
     lection.close()
예제 #18
0
 def activate_test_lection(self, file):
     lection = Vokker()
     lection.open(file)
     lection.read()
     return lection