Added first test
This commit is contained in:
parent
8bc142e4dd
commit
111073cb15
14
GUI/gui.py
14
GUI/gui.py
@ -2,7 +2,7 @@ from Tkinter import *
|
|||||||
import tkMessageBox
|
import tkMessageBox
|
||||||
|
|
||||||
from fourmi import search
|
from fourmi import search
|
||||||
from sourceloader import SourceLoader
|
from utils.sourceloader import SourceLoader
|
||||||
|
|
||||||
|
|
||||||
class ConfigImporter():
|
class ConfigImporter():
|
||||||
@ -33,6 +33,7 @@ class GUI():
|
|||||||
self.finish_with_search = False
|
self.finish_with_search = False
|
||||||
self.values = {}
|
self.values = {}
|
||||||
self.window, self.variables = self.generate_window(self.load_common_attributes(), self.load_output_types())
|
self.window, self.variables = self.generate_window(self.load_common_attributes(), self.load_output_types())
|
||||||
|
self.required_variables = ['']
|
||||||
|
|
||||||
def load_common_attributes(self):
|
def load_common_attributes(self):
|
||||||
"""Calls the configuration parser for common attributes."""
|
"""Calls the configuration parser for common attributes."""
|
||||||
@ -130,8 +131,6 @@ class GUI():
|
|||||||
|
|
||||||
def prepare_search(self):
|
def prepare_search(self):
|
||||||
"""Saves the values from the window for later retrieval."""
|
"""Saves the values from the window for later retrieval."""
|
||||||
self.finish_with_search = True
|
|
||||||
|
|
||||||
variables = self.variables
|
variables = self.variables
|
||||||
values = {}
|
values = {}
|
||||||
|
|
||||||
@ -149,7 +148,12 @@ class GUI():
|
|||||||
print "No known class, {}, {}".format(name, var)
|
print "No known class, {}, {}".format(name, var)
|
||||||
|
|
||||||
self.values = values
|
self.values = values
|
||||||
self.window.destroy()
|
if all([i in values.keys() for i in self.required_variables]):
|
||||||
|
self.finish_with_search = True
|
||||||
|
self.window.destroy()
|
||||||
|
else:
|
||||||
|
self.finish_with_search = False
|
||||||
|
tkMessageBox.showinfo('Not all required information was entered!')
|
||||||
|
|
||||||
def execute_search(self):
|
def execute_search(self):
|
||||||
"""Calls the Fourmi crawler with the values from the GUI"""
|
"""Calls the Fourmi crawler with the values from the GUI"""
|
||||||
@ -185,5 +189,3 @@ class GUI():
|
|||||||
self.execute_search()
|
self.execute_search()
|
||||||
else:
|
else:
|
||||||
tkMessageBox.showinfo("Notice", "No search was executed!")
|
tkMessageBox.showinfo("Notice", "No search was executed!")
|
||||||
|
|
||||||
GUI().run()
|
|
@ -1,2 +1,2 @@
|
|||||||
import FourmiCrawler, GUI, fourmi
|
|
||||||
|
|
||||||
|
19
tests/test_gui.py
Normal file
19
tests/test_gui.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import unittest
|
||||||
|
|
||||||
|
from GUI import gui
|
||||||
|
|
||||||
|
class TestGUI(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def test_empty_attributes(self):
|
||||||
|
test_gui = gui.GUI()
|
||||||
|
test_gui.run()
|
||||||
|
test_gui.prepare_search()
|
||||||
|
|
||||||
|
def test_no_configurations(self):
|
||||||
|
test_gui = gui.GUI()
|
||||||
|
#test_gui.
|
||||||
|
test_gui.run()
|
||||||
|
test_gui.prepare_search()
|
||||||
|
|
Reference in New Issue
Block a user