tests #13
1
win_venv/files/output/test.pdf
Normal file
1
win_venv/files/output/test.pdf
Normal file
@ -0,0 +1 @@
|
||||
{\rtf1}
|
@ -22,6 +22,9 @@ def files(path):
|
||||
for file in files_list:
|
||||
yield os.path.join(subdir, file)
|
||||
|
||||
def delete_file(file):
|
||||
os.remove(file)
|
||||
|
||||
def save_input(oldpath):
|
||||
# add timestamp to the filename, so it wouln't overwrite but the user still knows which file's which
|
||||
timestamp = str(int(time.time()))
|
||||
@ -77,7 +80,7 @@ class LibraryTableButtons(QWidget):
|
||||
self.exPopup = deletePopup()
|
||||
ret = self.exPopup.exec()
|
||||
if ret == self.exPopup.Yes:
|
||||
os.remove(file)
|
||||
delete_file(file)
|
||||
table.fillTable(type, mainWindow)
|
||||
|
||||
def analyzeFile():
|
||||
|
@ -22,6 +22,7 @@ class savingFileTest(unittest.TestCase):
|
||||
new_file_content += line
|
||||
|
||||
self.assertEqual(old_file_content, new_file_content)
|
||||
os.remove(newpath)
|
||||
|
||||
|
||||
# test using mock checking if a file with analysis had been generated
|
||||
@ -29,12 +30,34 @@ class generetingOutputFile(unittest.TestCase):
|
||||
|
||||
def test_output_file(self):
|
||||
|
||||
print('Moock testing outputfile')
|
||||
print('Mock testing outputfile')
|
||||
m = Mock()
|
||||
m.output_file_path = scriptPath + '\\files\\output\\test.pdf'
|
||||
|
||||
assert Path(m.output_file_path).is_file()
|
||||
|
||||
|
||||
# test deleting input file
|
||||
class testDeleteFile(unittest.TestCase):
|
||||
|
||||
def test_delete_file(self):
|
||||
|
||||
print('Testing deleting the file')
|
||||
new_file = inputFilePath + os.path.sep + 'new_file.txt'
|
||||
with open(new_file, 'w') as file:
|
||||
file.write('teeeest')
|
||||
|
||||
with open(new_file) as f:
|
||||
content = f.read()
|
||||
|
||||
assert os.path.exists(new_file)
|
||||
self.assertEqual(content, 'teeeest')
|
||||
|
||||
delete_file(new_file)
|
||||
|
||||
self.assertFalse(os.path.exists(new_file))
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Loading…
Reference in New Issue
Block a user