kopia lustrzana https://github.com/simonw/datasette
Applied Black, refs #1368
rodzic
baf986c871
commit
05a312caf3
|
@ -855,24 +855,20 @@ def test_hook_skip_csrf(app_client):
|
||||||
def test_hook_get_metadata(app_client):
|
def test_hook_get_metadata(app_client):
|
||||||
app_client.ds._metadata_local = {
|
app_client.ds._metadata_local = {
|
||||||
"title": "Testing get_metadata hook!",
|
"title": "Testing get_metadata hook!",
|
||||||
"databases": {
|
"databases": {"from-local": {"title": "Hello from local metadata"}},
|
||||||
"from-local": {
|
|
||||||
"title": "Hello from local metadata"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
og_pm_hook_get_metadata = pm.hook.get_metadata
|
og_pm_hook_get_metadata = pm.hook.get_metadata
|
||||||
|
|
||||||
def get_metadata_mock(*args, **kwargs):
|
def get_metadata_mock(*args, **kwargs):
|
||||||
return [{
|
return [
|
||||||
"databases": {
|
{
|
||||||
"from-hook": {
|
"databases": {
|
||||||
"title": "Hello from the plugin hook"
|
"from-hook": {"title": "Hello from the plugin hook"},
|
||||||
},
|
"from-local": {"title": "This will be overwritten!"},
|
||||||
"from-local": {
|
|
||||||
"title": "This will be overwritten!"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}]
|
]
|
||||||
|
|
||||||
pm.hook.get_metadata = get_metadata_mock
|
pm.hook.get_metadata = get_metadata_mock
|
||||||
meta = app_client.ds.metadata()
|
meta = app_client.ds.metadata()
|
||||||
assert "Testing get_metadata hook!" == meta["title"]
|
assert "Testing get_metadata hook!" == meta["title"]
|
||||||
|
|
Ładowanie…
Reference in New Issue