Beispiel #1
0
def test_screen_shows_form_validation_error_on_create_new_session(
        empty_registry, bad_connection_data):
    sessions_select_screen = session_select.SessionSelect(empty_registry)

    sessions_select_screen.view.keypress(screen_size, 'y')

    form = sessions_select_screen._edit_form_widget
    form.refresh(bad_connection_data['data'])
    form.keypress((screen_size[0], ), 'f1')

    assert form._status_bar.text == bad_connection_data['expected_message']
Beispiel #2
0
def test_screen_deletes_session(registry_with_a_session):
    sessions_select_screen = session_select.SessionSelect(
        registry_with_a_session)

    sessions_list_widget = sessions_select_screen.view.original_widget.body
    sessions_list_widget.keypress((screen_size[0], ), 'd')

    assert isinstance(
        sessions_select_screen.view.original_widget.body.original_widget,
        CreateNewSessionDialog) is True
    assert registry_with_a_session.is_empty() is True
Beispiel #3
0
def test_screen_adds_new_session(empty_registry, good_connection_data):
    sessions_select_screen = session_select.SessionSelect(empty_registry)

    sessions_select_screen.view.keypress(screen_size, 'y')

    form = sessions_select_screen._edit_form_widget
    form.refresh(good_connection_data)
    form.keypress((screen_size[0], ), 'f1')

    assert empty_registry.is_empty() is False
    assert isinstance(sessions_select_screen.view.original_widget.body,
                      SavedSessionsList) is True
Beispiel #4
0
def test_screen_shows_form_validation_error_on_edit(registry_with_a_session,
                                                    bad_connection_data):
    sessions_select_screen = session_select.SessionSelect(
        registry_with_a_session)

    sessions_list_widget = sessions_select_screen.view.original_widget.body

    sessions_list_widget.keypress((screen_size[0], ), 'e')

    form = sessions_select_screen._edit_form_widget
    form.refresh(bad_connection_data['data'], False)

    form.keypress((screen_size[0], ), 'f1')
    assert isinstance(sessions_select_screen.view.original_widget.body,
                      EditSessionForm) is True
    assert form._status_bar.text == bad_connection_data['expected_message']
Beispiel #5
0
def test_screen_edits_session(registry_with_a_session):
    sessions_select_screen = session_select.SessionSelect(
        registry_with_a_session)

    sessions_list_widget = sessions_select_screen.view.original_widget.body
    sessions_list_widget.keypress((screen_size[0], ), 'e')

    form_data = registry_with_a_session['Test session']
    form_data['name'] = 'Test session'
    form = sessions_select_screen._edit_form_widget
    form.refresh(form_data, False)

    form._input_elements['name'].edit_text = 'Edited session'

    form.keypress((screen_size[0], ), 'f1')
    assert registry_with_a_session.has_session('Edited session')
    assert len(registry_with_a_session.sessions) == 1
Beispiel #6
0
def test_screen_shows_the_create_new_session_form(empty_registry):
    sessions_select_screen = session_select.SessionSelect(empty_registry)
    sessions_select_screen.view.keypress(screen_size, 'y')
    assert isinstance(sessions_select_screen.view.original_widget.body,
                      EditSessionForm) is True
Beispiel #7
0
def test_screen_displays_create_new_session_dialog(empty_registry):
    sessions_select_screen = session_select.SessionSelect(empty_registry)
    assert isinstance(
        sessions_select_screen.view.original_widget.body.original_widget,
        CreateNewSessionDialog) is True
Beispiel #8
0
def test_screen_displays_sessions_list(registry_with_a_session):
    sessions_select_screen = session_select.SessionSelect(
        registry_with_a_session)
    assert isinstance(sessions_select_screen.view.original_widget.body,
                      SavedSessionsList) is True