Last active
October 8, 2021 21:02
-
-
Save robintw/a4dc49d139807ee8f04cd4eb5d9c9e19 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async def test_select_platform_type(test_datastore): | |
# Test application in a dummy session. | |
input = DummyInput() | |
output = DummyOutput() | |
# output = None | |
with create_app_session(output=output, input=input): | |
gui = MaintenanceGUI(test_datastore) | |
task = asyncio.create_task(gui.app.run_async()) | |
ready_event = asyncio.Event() | |
gui.app.after_render += lambda _: ready_event.set() | |
await ready_event.wait() | |
ready_event.clear() | |
# Type 'PlatformTy' - which filters a dropdown box on every keypress | |
for letter in "PlatformTy": | |
gui.app.key_processor.feed(KeyPress(letter)) | |
gui.app.key_processor.process_keys() | |
await ready_event.wait() | |
ready_event.clear() | |
# Send Enter to select the 'PlatformTypes' entry | |
gui.app.key_processor.feed(KeyPress(Keys.ControlM, "\r")) | |
gui.app.key_processor.process_keys() | |
await ready_event.wait() | |
ready_event.clear() | |
assert gui.current_table_object == test_datastore.db_classes.PlatformType | |
# Send Enter to say yes | |
gui.app.exit() | |
# Wait for the application to properly terminate. | |
await task |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment