def test_interface_displays_selected_option(self):
self.catalog_api.get_all_catalogs.return_value = [
{
"id": self.catalog_id,
"name": "My Catalog"
},
{
"id": 1,
"name": "Other catalog!"
}
]
customer = EnterpriseCustomerFactory(
catalog=99,
)
form = EnterpriseCustomerAdminForm(
{
'catalog': '',
'enforce_data_sharing_consent': customer.enforce_data_sharing_consent,
'site': customer.site.id,
'name': customer.name,
'active': customer.active
},
instance=customer,
)
assert isinstance(form.fields['catalog'], forms.ChoiceField)
assert form.fields['catalog'].choices == BLANK_CHOICE_DASH + [
(self.catalog_id, 'My Catalog'),
(1, 'Other catalog!'),
]
评论列表
文章目录