mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Fixed incorrect display of compound primary keys with foreign key references
Closes #319
This commit is contained in:
parent
3683a6b626
commit
3b53eea382
5 changed files with 122 additions and 10 deletions
|
|
@ -75,11 +75,34 @@ def test_path_with_replaced_args(path, args, expected):
|
|||
assert expected == actual
|
||||
|
||||
|
||||
@pytest.mark.parametrize('row,pks,expected_path', [
|
||||
({'A': 'foo', 'B': 'bar'}, ['A', 'B'], 'foo,bar'),
|
||||
({'A': 'f,o', 'B': 'bar'}, ['A', 'B'], 'f%2Co,bar'),
|
||||
({'A': 123}, ['A'], '123'),
|
||||
])
|
||||
@pytest.mark.parametrize(
|
||||
"row,pks,expected_path",
|
||||
[
|
||||
({"A": "foo", "B": "bar"}, ["A", "B"], "foo,bar"),
|
||||
({"A": "f,o", "B": "bar"}, ["A", "B"], "f%2Co,bar"),
|
||||
({"A": 123}, ["A"], "123"),
|
||||
(
|
||||
utils.CustomRow(
|
||||
["searchable_id", "tag"],
|
||||
[
|
||||
(
|
||||
"searchable_id",
|
||||
{"value": 1, "label": "1"},
|
||||
),
|
||||
(
|
||||
"tag",
|
||||
{
|
||||
"value": "feline",
|
||||
"label": "feline",
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
["searchable_id", "tag"],
|
||||
"1,feline",
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_path_from_row_pks(row, pks, expected_path):
|
||||
actual_path = utils.path_from_row_pks(row, pks, False)
|
||||
assert expected_path == actual_path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue