test_forms.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:edx-enterprise 作者: edx 项目源码 文件源码
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!'),
        ]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号