Fix tests I broke in #2302

pull/2082/merge
Simon Willison 2024-03-12 17:01:51 -07:00
rodzic 9cc6f1908f
commit feddd61789
2 zmienionych plików z 6 dodań i 3 usunięć

Wyświetl plik

@ -26,7 +26,7 @@
<li><a href="/-/plugins">Installed plugins</a></li> <li><a href="/-/plugins">Installed plugins</a></li>
<li><a href="/-/versions">Version info</a></li> <li><a href="/-/versions">Version info</a></li>
</ul> </ul>
<form action="/-/logout" method="post"> <form class="nav-menu-logout" action="/-/logout" method="post">
<button class="button-as-link">Log out</button> <button class="button-as-link">Log out</button>
</form> </form>
</div> </div>

Wyświetl plik

@ -110,7 +110,7 @@ async def test_logout_button_in_navigation(ds_client, path):
anon_response = await ds_client.get(path) anon_response = await ds_client.get(path)
for fragment in ( for fragment in (
"<strong>test</strong>", "<strong>test</strong>",
'<form action="/-/logout" method="post">', '<form class="nav-menu-logout" action="/-/logout" method="post">',
): ):
assert fragment in response.text assert fragment in response.text
assert fragment not in anon_response.text assert fragment not in anon_response.text
@ -121,7 +121,10 @@ async def test_logout_button_in_navigation(ds_client, path):
async def test_no_logout_button_in_navigation_if_no_ds_actor_cookie(ds_client, path): async def test_no_logout_button_in_navigation_if_no_ds_actor_cookie(ds_client, path):
response = await ds_client.get(path + "?_bot=1") response = await ds_client.get(path + "?_bot=1")
assert "<strong>bot</strong>" in response.text assert "<strong>bot</strong>" in response.text
assert '<form action="/-/logout" method="post">' not in response.text assert (
'<form class="nav-menu-logout" action="/-/logout" method="post">'
not in response.text
)
@pytest.mark.parametrize( @pytest.mark.parametrize(