Added another test
This commit is contained in:
parent
a284a5f558
commit
9436ccbbe2
@ -30,7 +30,6 @@ class GUI():
|
||||
self.configurator = ConfigImporter('GUI/gui.cfg')
|
||||
self.finish_with_search = False
|
||||
self.values = {}
|
||||
self.window, self.variables = self.generate_window(self.load_common_attributes(), self.load_output_types())
|
||||
self.required_variables = ['substance']
|
||||
self.search = search
|
||||
|
||||
@ -185,6 +184,7 @@ class GUI():
|
||||
|
||||
def run(self):
|
||||
"""Starts the window and the search."""
|
||||
self.window, self.variables = self.generate_window(self.load_common_attributes(), self.load_output_types())
|
||||
self.window.mainloop()
|
||||
if self.finish_with_search:
|
||||
self.execute_search()
|
||||
|
@ -7,19 +7,23 @@ class TestGUI(unittest.TestCase):
|
||||
pass
|
||||
|
||||
def test_empty_attributes(self):
|
||||
test_gui = gui.GUI()
|
||||
test_gui = gui.GUI(None)
|
||||
test_gui.configurator = gui.ConfigImporter('../GUI/gui.cfg')
|
||||
test_gui.window.after(10, test_gui.window.destroy)
|
||||
test_gui.run()
|
||||
test_gui.prepare_search()
|
||||
|
||||
def test_no_configurations(self):
|
||||
import os
|
||||
config_name = 'gui.cfg'
|
||||
with open(config_name) as config_file:
|
||||
file_contents = config_file.read()
|
||||
os.remove(config_name)
|
||||
|
||||
test_gui = gui.GUI()
|
||||
test_gui = gui.GUI(None)
|
||||
test_gui.configurator = gui.ConfigImporter(None)
|
||||
test_gui.finish_with_search = True
|
||||
|
||||
test_gui.variables= {'substance':''}
|
||||
test_gui.window.after(10, test_gui.prepare_search)
|
||||
test_gui.window.after(10, test_gui.window.destroy)
|
||||
test_gui.run()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user