more menu testing
-import curses
import npyscreen
+import time
from vent.menu import VentApp
-npyscreen.TEST_SETTINGS['TEST_INPUT'] = ['\n', '^T', '^T', '^X', '\033']
npyscreen.TEST_SETTINGS['CONTINUE_AFTER_TEST_INPUT'] = False
def test_integration():
""" Run integration tests """
+ # close tutorial
+ npyscreen.TEST_SETTINGS['TEST_INPUT'] = ['\n']
+
+ # go to help
+ npyscreen.TEST_SETTINGS['TEST_INPUT'] += ['^T']
+
+ # go through help menus
+ npyscreen.TEST_SETTINGS['TEST_INPUT'] += ['^X', 'b', 'm', '\n', '\n']
+ npyscreen.TEST_SETTINGS['TEST_INPUT'] += ['^X', 'b', 'p', '\n', '\n']
+ npyscreen.TEST_SETTINGS['TEST_INPUT'] += ['^X', 'b', 't', '\n', '\n']
+ npyscreen.TEST_SETTINGS['TEST_INPUT'] += ['^X', 'b', 'f', '\n', '\n']
+ npyscreen.TEST_SETTINGS['TEST_INPUT'] += ['^X', 'b', 'c', '\n', '\n']
+ npyscreen.TEST_SETTINGS['TEST_INPUT'] += ['^X', 'b', 's', '\n', '\n']
+ npyscreen.TEST_SETTINGS['TEST_INPUT'] += ['^X', 'p', 'a', '\n', '\n']
+ npyscreen.TEST_SETTINGS['TEST_INPUT'] += ['^X', 'p', 'b', '\n', '\n']
+
+ # leave help menu
+ npyscreen.TEST_SETTINGS['TEST_INPUT'] += ['\n']
+
+ # to go through main menus
+ npyscreen.TEST_SETTINGS['TEST_INPUT'] += ['^X', '\033']
+
A = VentApp()
try:
A.run(fork=False)
@@ -18,3 +39,14 @@ def test_integration():
# add a repo, build it, remove it
# add a tool in a repo, build it, remove it
# add a set of tools at a specific version in a repo, build them, and remove them
+
+def test_second_run():
+ """ Run a second time """
+ npyscreen.TEST_SETTINGS['TEST_INPUT'] = []
+ A = VentApp()
+ try:
+ A.run(fork=False)
+ except npyscreen.ExhaustedTestInput as e:
+ time.sleep(10)
+ else:
+ raise npyscreen.ExhaustedTestInput
