diff --git a/tildes/scss/modules/_tab.scss b/tildes/scss/modules/_tab.scss index 9bd7a19..91e0286 100644 --- a/tildes/scss/modules/_tab.scss +++ b/tildes/scss/modules/_tab.scss @@ -28,3 +28,7 @@ } } } + +.tab-listing-order.tab-flex-2 { + flex: 2; +} diff --git a/tildes/tests/conftest.py b/tildes/tests/conftest.py index ea6da3d..36617fb 100644 --- a/tildes/tests/conftest.py +++ b/tildes/tests/conftest.py @@ -199,14 +199,20 @@ def webtest(base_app): # create the TestApp - note that specifying wsgi.url_scheme is necessary so that the # secure cookies from the session library will work app = TestApp( - base_app, extra_environ={"wsgi.url_scheme": "https"}, cookiejar=CookieJar() + base_app, + # This "tm.active" is a temporary fix around this fixture failing to rollback + # data after the tests are complete. + extra_environ={"wsgi.url_scheme": "https", "tm.active": True}, + cookiejar=CookieJar(), ) # fetch the login page, fill in the form, and submit it (sets the cookie) login_page = app.get("/login") login_page.form["username"] = "SessionUser" login_page.form["password"] = "session user password" - login_page.form.submit() + # The login process requires a non-None IP address; this + # populates `request.client_addr`. + login_page.form.submit(extra_environ={"HTTP_X_FORWARDED_FOR": "0.0.0.0"}) yield app diff --git a/tildes/tests/webtests/test_user_settings.py b/tildes/tests/webtests/test_user_settings.py new file mode 100644 index 0000000..fe647e2 --- /dev/null +++ b/tildes/tests/webtests/test_user_settings.py @@ -0,0 +1,8 @@ +def test_render_theme_options(webtest): + """Test that theme settings are being rendered.""" + settings = webtest.get("/settings") + assert settings.status_int == 200 + assert "White (site and account default)
- +
- diff --git a/tildes/tildes/views/settings.py b/tildes/tildes/views/settings.py index 63f0a64..bb5f95d 100644 --- a/tildes/tildes/views/settings.py +++ b/tildes/tildes/views/settings.py @@ -19,16 +19,17 @@ def get_settings(request: Request) -> dict: current_theme = ( request.cookies.get("theme", "") or request.user.theme_account_default ) + user_default = request.user.theme_account_default or "white" theme_options = { "white": "White", "light": "Solarized Light", "dark": "Solarized Dark", "black": "Black", } - if DEFAULT_THEME_NAME == request.user.theme_account_default: + if DEFAULT_THEME_NAME == user_default: theme_options[DEFAULT_THEME_NAME] += " (site and account default)" else: - theme_options[request.user.theme_account_default] += " (account default)" + theme_options[user_default] += " (account default)" theme_options[DEFAULT_THEME_NAME] += " (site default)" return {"current_theme": current_theme, "theme_options": theme_options}