32 lines
1 KiB
Python
32 lines
1 KiB
Python
import pytest
|
|
|
|
|
|
toga = pytest.importorskip("toga")
|
|
|
|
from funkyjuicerecipes.app import main, FunkyJuiceRecipesApp
|
|
|
|
|
|
def test_ui_views_construct():
|
|
# Construct views without starting event loop
|
|
app = FunkyJuiceRecipesApp("funkyjuicerecipes", "com.targonproducts.funkyjuicerecipes")
|
|
|
|
from funkyjuicerecipes.ui.views.recipe_list import RecipeListView
|
|
from funkyjuicerecipes.ui.views.inventory import InventoryView
|
|
from funkyjuicerecipes.ui.views.edit_recipe import EditRecipeView
|
|
from funkyjuicerecipes.ui.views.view_recipe import ViewRecipeView
|
|
from funkyjuicerecipes.ui.main_window import build_main_window
|
|
|
|
assert RecipeListView(app) is not None
|
|
assert InventoryView(app) is not None
|
|
assert EditRecipeView(app) is not None
|
|
assert ViewRecipeView(app) is not None
|
|
|
|
# Build main window; do not show it
|
|
win = build_main_window(app)
|
|
assert isinstance(win, toga.MainWindow)
|
|
|
|
|
|
def test_main_returns_app_instance():
|
|
app = main()
|
|
assert isinstance(app, FunkyJuiceRecipesApp)
|