Ejemplo n.º 1
0
    def test_read_opend_file(self):
        file = "normal.vok"
        lection = Vokker()
        lection.open(file)

        rt = lection.read()
        self.assertTrue(rt)
        lection.close
Ejemplo n.º 2
0
    def test_create_new_datafile(self):
        datafile = 'test.vok'
        lection = Vokker()

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

        lection.close()
Ejemplo n.º 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)
Ejemplo n.º 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()
Ejemplo n.º 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):
Ejemplo n.º 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()
Ejemplo n.º 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()
Ejemplo n.º 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()
Ejemplo n.º 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")
Ejemplo n.º 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()
Ejemplo n.º 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)
Ejemplo n.º 12
0
 def test_fileexist(self):
     file = "normal.vok"
     lec = Vokker()
     rt = lec.fileexist(file)
     self.assertTrue(rt)
Ejemplo n.º 13
0
 def test_init_instance(self):
     lection = Vokker()
     self.assertIsInstance(lection, Vokker)
Ejemplo n.º 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!!! ")
Ejemplo n.º 15
0
 def test_read_FAIL_not_opend_file(self):
     lection = Vokker()
     rt = lection.read()
     self.assertFalse(rt)
Ejemplo n.º 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!!!')
Ejemplo n.º 17
0
 def test_open_existing_file(self):
     datafile = 'test.vok'
     lection = Vokker()
     rt = lection.open(datafile)
     self.assertTrue(rt)
     lection.close()
Ejemplo n.º 18
0
 def activate_test_lection(self, file):
     lection = Vokker()
     lection.open(file)
     lection.read()
     return lection