Beispiel #1
0
def test_card_next_card_with_string():
    """
    Ensure the string value set as the auto_target is used to transition the
    screen manager.
    """
    card = Card("title")
    card.data_store = {}
    card.form_value = mock.MagicMock(return_value=None)
    card.auto_target = "AnotherCard"
    card.screen_manager = mock.MagicMock()
    card._next_card(0.1)
    assert card.screen_manager.current == "AnotherCard"
Beispiel #2
0
def test_card_next_card_with_callable():
    """
    Ensure the string return value of the function set as the auto_target is
    used to transition the screen manager.
    """
    def fn(data_store, form_value):
        return "AnotherCard"

    card = Card("title")
    card.data_store = {}
    card.form_value = mock.MagicMock(return_value=None)
    card.auto_target = fn
    card.screen_manager = mock.MagicMock()
    card._next_card(0.1)
    assert card.screen_manager.current == "AnotherCard"