kopia lustrzana https://github.com/simonw/datasette
Don't include _memory on /-/create-token, refs #1947
rodzic
420d0a0ee2
commit
1a3dcf4943
|
@ -235,7 +235,7 @@ class CreateTokenView(BaseView):
|
||||||
# Build list of databases and tables the user has permission to view
|
# Build list of databases and tables the user has permission to view
|
||||||
database_with_tables = []
|
database_with_tables = []
|
||||||
for database in self.ds.databases.values():
|
for database in self.ds.databases.values():
|
||||||
if database.name == "_internal":
|
if database.name in ("_internal", "_memory"):
|
||||||
continue
|
continue
|
||||||
if not await self.ds.permission_allowed(
|
if not await self.ds.permission_allowed(
|
||||||
request.actor, "view-database", database.name
|
request.actor, "view-database", database.name
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from bs4 import BeautifulSoup as Soup
|
||||||
from .fixtures import app_client
|
from .fixtures import app_client
|
||||||
from click.testing import CliRunner
|
from click.testing import CliRunner
|
||||||
from datasette.utils import baseconv
|
from datasette.utils import baseconv
|
||||||
|
@ -160,6 +161,17 @@ def test_auth_create_token(
|
||||||
response = app_client.get("/-/create-token", cookies={"ds_actor": ds_actor})
|
response = app_client.get("/-/create-token", cookies={"ds_actor": ds_actor})
|
||||||
assert response.status == 200
|
assert response.status == 200
|
||||||
assert ">Create an API token<" in response.text
|
assert ">Create an API token<" in response.text
|
||||||
|
# Confirm some aspects of expected set of checkboxes
|
||||||
|
soup = Soup(response.text, "html.parser")
|
||||||
|
checkbox_names = {el["name"] for el in soup.select('input[type="checkbox"]')}
|
||||||
|
assert checkbox_names.issuperset(
|
||||||
|
{
|
||||||
|
"all:view-instance",
|
||||||
|
"all:view-query",
|
||||||
|
"database:fixtures:drop-table",
|
||||||
|
"resource:fixtures:foreign_key_references:insert-row",
|
||||||
|
}
|
||||||
|
)
|
||||||
# Now try actually creating one
|
# Now try actually creating one
|
||||||
response2 = app_client.post(
|
response2 = app_client.post(
|
||||||
"/-/create-token",
|
"/-/create-token",
|
||||||
|
|
Ładowanie…
Reference in New Issue