Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: fix quickstart #1125

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions tests/unit_tests/test_tethys_apps/test_base/test_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,24 @@ def test_register_controllers_catch_all(
mock_UrlMap.assert_called_with(
name="catch_all", url="root/.*/", controller=mock_controller
)

def test__get_url_map_kwargs_list_url_dict(self):
result = tethys_controller._get_url_map_kwargs_list(
url={
"test": "test/url/",
"another_test": "test/{another}/url/",
}
)
self.assertEqual(result[0]["title"], "Test")
self.assertEqual(result[1]["title"], "Another Test")

def test__get_url_map_kwargs_list_url_list(self):
result = tethys_controller._get_url_map_kwargs_list(
name="test",
url=[
"test/url/",
"test/{another}/url/",
],
)
self.assertEqual(result[0]["title"], "Test")
self.assertEqual(result[1]["title"], "Test 1")
7 changes: 2 additions & 5 deletions tethys_apps/base/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,9 +821,6 @@ def _get_url_map_kwargs_list(
for i, final_url in enumerate(final_urls)
}

if not title:
title = url_name.replace("_", " ").title()

return [
dict(
name=url_name,
Expand All @@ -833,7 +830,7 @@ def _get_url_map_kwargs_list(
regex=regex,
handler=handler,
handler_type=handler_type,
title=title,
title=title or url_name.replace("_", " ").title(),
index=index,
)
for url_name, final_url in final_urls.items()
Expand Down Expand Up @@ -950,7 +947,7 @@ def register_controllers(
UrlMap = url_map_maker(root_url)
url_maps = [UrlMap(**kwargs) for name, kwargs in names.items()]

# Add a catch all endpoint for any URL following the app's root URL and map it to the named controller
# Add a catch-all endpoint for any URL following the app's root URL and map it to the named controller
if catch_all and catch_all in names:
url_maps.append(
UrlMap(
Expand Down
1 change: 1 addition & 0 deletions tethys_cli/start_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def quickstart_command(args):
services_file=None,
quiet=True,
no_sync_stores=False,
update_installed=False,
)
install_command(app_install_args)

Expand Down
Loading