diff --git a/frontend/src/store/modules/userSettings.js b/frontend/src/store/modules/userSettings.js index b608e2cf3..1f2c56dbe 100644 --- a/frontend/src/store/modules/userSettings.js +++ b/frontend/src/store/modules/userSettings.js @@ -60,7 +60,7 @@ const actions = { }, async resetTheme({ commit }) { - const defaultTheme = await api.themes.requestByName("default"); + const defaultTheme = await api.themes.requestByName(1); if (defaultTheme.colors) { Vuetify.framework.theme.themes.dark = defaultTheme.colors; Vuetify.framework.theme.themes.light = defaultTheme.colors; diff --git a/tests/integration_tests/test_settings_routes.py b/tests/integration_tests/test_settings_routes.py index 2a6f30510..2076d37db 100644 --- a/tests/integration_tests/test_settings_routes.py +++ b/tests/integration_tests/test_settings_routes.py @@ -14,18 +14,19 @@ def default_settings(): @pytest.fixture(scope="session") def default_theme(): - return SiteTheme().dict() + return SiteTheme(id=1).dict() @pytest.fixture(scope="session") def new_theme(): return { + "id": 2, "name": "myTestTheme", "colors": { "primary": "#E58325", "accent": "#00457A", "secondary": "#973542", - "success": "#5AB1BB", + "success": "#43A047", "info": "#4990BA", "warning": "#FF4081", "error": "#EF5350", @@ -54,7 +55,7 @@ def test_update_settings(api_client: TestClient, api_routes: AppRoutes, default_ def test_default_theme(api_client: TestClient, api_routes: AppRoutes, default_theme): - response = api_client.get(api_routes.themes_theme_name("default")) + response = api_client.get(api_routes.themes_theme_name(1)) assert response.status_code == 200 assert json.loads(response.content) == default_theme @@ -64,7 +65,7 @@ def test_create_theme(api_client: TestClient, api_routes: AppRoutes, new_theme, response = api_client.post(api_routes.themes_create, json=new_theme, headers=token) assert response.status_code == 201 - response = api_client.get(api_routes.themes_theme_name(new_theme.get("name")), headers=token) + response = api_client.get(api_routes.themes_theme_name(new_theme.get("id")), headers=token) assert response.status_code == 200 assert json.loads(response.content) == new_theme @@ -77,7 +78,7 @@ def test_read_all_themes(api_client: TestClient, api_routes: AppRoutes, default_ def test_read_theme(api_client: TestClient, api_routes: AppRoutes, default_theme, new_theme): for theme in [default_theme, new_theme]: - response = api_client.get(api_routes.themes_theme_name(theme.get("name"))) + response = api_client.get(api_routes.themes_theme_name(theme.get("id"))) assert response.status_code == 200 assert json.loads(response.content) == theme @@ -94,14 +95,14 @@ def test_update_theme(api_client: TestClient, api_routes: AppRoutes, token, defa } new_theme["colors"] = theme_colors - response = api_client.put(api_routes.themes_theme_name(new_theme.get("name")), json=new_theme, headers=token) + response = api_client.put(api_routes.themes_theme_name(new_theme.get("id")), json=new_theme, headers=token) assert response.status_code == 200 - response = api_client.get(api_routes.themes_theme_name(new_theme.get("name"))) + response = api_client.get(api_routes.themes_theme_name(new_theme.get("id"))) assert json.loads(response.content) == new_theme def test_delete_theme(api_client: TestClient, api_routes: AppRoutes, default_theme, new_theme, token): for theme in [default_theme, new_theme]: - response = api_client.delete(api_routes.themes_theme_name(theme.get("name")), headers=token) + response = api_client.delete(api_routes.themes_theme_name(theme.get("id")), headers=token) assert response.status_code == 200