470 |
470 |
['Category A', [{'id': 'test', 'label': 'Test'}]],
|
471 |
471 |
['Category B', [{'id': 'test-2', 'label': 'test 2'}]],
|
472 |
472 |
],
|
473 |
|
}
|
|
473 |
},
|
|
474 |
{
|
|
475 |
"id": "cards_count",
|
|
476 |
"label": "Cards",
|
|
477 |
"options": [
|
|
478 |
['Category A', [{'id': 'test', 'label': 'Test'}]],
|
|
479 |
['Category B', [{'id': 'test-2', 'label': 'test 2'}]],
|
|
480 |
],
|
|
481 |
"required": True,
|
|
482 |
},
|
474 |
483 |
],
|
475 |
484 |
},
|
476 |
485 |
{
|
... | ... | |
500 |
509 |
},
|
501 |
510 |
],
|
502 |
511 |
},
|
|
512 |
{
|
|
513 |
'url': 'https://authentic.example.com/api/statistics/required-without-default/',
|
|
514 |
'name': 'Required without default',
|
|
515 |
'id': 'required-without-default',
|
|
516 |
"filters": [
|
|
517 |
{
|
|
518 |
"id": "test",
|
|
519 |
"label": "Test",
|
|
520 |
"options": [
|
|
521 |
{"id": "b", "label": "B"},
|
|
522 |
{"id": "a", "label": "A"},
|
|
523 |
],
|
|
524 |
"required": True,
|
|
525 |
},
|
|
526 |
],
|
|
527 |
},
|
503 |
528 |
]
|
504 |
529 |
}
|
505 |
530 |
|
... | ... | |
1450 |
1475 |
assert resp.pyquery('optgroup[label="Category A"] option').val() == 'test'
|
1451 |
1476 |
assert resp.pyquery('optgroup[label="Category B"] option').val() == 'test-2'
|
1452 |
1477 |
|
|
1478 |
assert resp.form[field_prefix + 'cards_count'].options == [
|
|
1479 |
('test', True, 'Test'),
|
|
1480 |
('test-2', False, 'test 2'),
|
|
1481 |
]
|
|
1482 |
cell.refresh_from_db()
|
|
1483 |
assert cell.filter_params == {'cards_count': 'test'}
|
|
1484 |
|
|
1485 |
required_without_default_stat = Statistic.objects.get(slug='required-without-default')
|
|
1486 |
resp.form[field_prefix + 'statistic'] = required_without_default_stat.pk
|
|
1487 |
manager_submit_cell(resp.form)
|
|
1488 |
assert resp.form[field_prefix + 'test'].options == [
|
|
1489 |
('b', True, 'B'),
|
|
1490 |
('a', False, 'A'),
|
|
1491 |
]
|
|
1492 |
cell.refresh_from_db()
|
|
1493 |
assert cell.filter_params == {'test': 'b'}
|
|
1494 |
|
1453 |
1495 |
deprecated_stat = Statistic.objects.get(slug='deprecated-filter')
|
1454 |
1496 |
resp.form[field_prefix + 'statistic'] = deprecated_stat.pk
|
1455 |
1497 |
manager_submit_cell(resp.form)
|
1456 |
|
-
|