def test_load_actions(): app = Pantam() app.read_actions_folder = Mock(return_value=["index.py"]) # type: ignore app.import_action_module = Mock(return_value=MockAction) # type: ignore app.discover_actions() app.load_actions() actions = app.get_actions() assert actions[0]["action_class"] == MockAction assert isinstance(actions[0]["action_obj"], MockAction) assert actions[0]["file_name"] == "index.py" assert actions[0]["module_name"] == "index" assert actions[0]["class_name"] == "Index" assert actions[0]["routes"] == []
def test_discover_actions(): app = Pantam() app.read_actions_folder = Mock(return_value=["index.py", "auth_test.py" ]) # type: ignore actions = app.discover_actions() expected = [ { "file_name": "index.py", "module_name": "index", "class_name": "Index", "routes": [], }, { "file_name": "auth_test.py", "module_name": "auth-test", "class_name": "AuthTest", "routes": [], }, ] assert actions == expected