Esempio n. 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"
Esempio n. 2
0
def test_card_button_click_with_string():
    """
    Ensure the function returned from the _button_click method works by
    transitioning the screen manager to the string value it returns.
    """
    card = Card("title")
    card.data_store = {}
    card.form_value = mock.MagicMock(return_value=None)
    card.screen_manager = mock.MagicMock()
    handler = card._button_click("AnotherCard")
    assert callable(handler)
    handler(None)
    assert card.screen_manager.current == "AnotherCard"
Esempio n. 3
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"