当前位置: 首页>>代码示例>>Python>>正文


Python forms.EditThemeOwnerForm类代码示例

本文整理汇总了Python中olympia.addons.forms.EditThemeOwnerForm的典型用法代码示例。如果您正苦于以下问题:Python EditThemeOwnerForm类的具体用法?Python EditThemeOwnerForm怎么用?Python EditThemeOwnerForm使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了EditThemeOwnerForm类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_initial

    def test_initial(self):
        self.form = EditThemeOwnerForm(None, instance=self.instance)
        assert self.form.initial == {}

        self.instance.addonuser_set.create(user_id=999)
        assert self.instance.addonuser_set.all()[0].user.email == ("[email protected]")
        self.form = EditThemeOwnerForm(None, instance=self.instance)
        assert self.form.initial == {"owner": "[email protected]"}
开发者ID:lavish205,项目名称:olympia,代码行数:8,代码来源:test_forms.py

示例2: test_initial

    def test_initial(self):
        self.form = EditThemeOwnerForm(None, instance=self.instance)
        eq_(self.form.initial, {})

        self.instance.addonuser_set.create(user_id=999)
        eq_(self.instance.addonuser_set.all()[0].user.email,
            '[email protected]')
        self.form = EditThemeOwnerForm(None, instance=self.instance)
        eq_(self.form.initial, {'owner': '[email protected]'})
开发者ID:gffbss,项目名称:addons-server,代码行数:9,代码来源:test_forms.py

示例3: test_success_change_from_no_owner

 def test_success_change_from_no_owner(self):
     self.form = EditThemeOwnerForm({'owner': '[email protected]'},
                                    instance=self.instance)
     assert self.form.is_valid(), self.form.errors
     self.form.save()
     assert self.instance.addonuser_set.all()[0].user.email == (
         '[email protected]')
开发者ID:tsl143,项目名称:addons-server,代码行数:7,代码来源:test_forms.py

示例4: test_success_replace_owner

 def test_success_replace_owner(self):
     self.instance.addonuser_set.create(user_id=999)
     self.form = EditThemeOwnerForm({'owner': '[email protected]'},
                                    instance=self.instance)
     assert self.form.is_valid(), self.form.errors
     self.form.save()
     assert self.instance.addonuser_set.all()[0].user.email == (
         '[email protected]')
开发者ID:tsl143,项目名称:addons-server,代码行数:8,代码来源:test_forms.py

示例5: TestEditThemeOwnerForm

class TestEditThemeOwnerForm(TestCase):
    fixtures = ['base/users']

    def setUp(self):
        super(TestEditThemeOwnerForm, self).setUp()
        self.instance = Addon.objects.create(
            type=amo.ADDON_PERSONA,
            status=amo.STATUS_PUBLIC, slug='swag-overload',
            name='Bands Make Me Dance', description='tha description')
        Persona.objects.create(
            persona_id=0, addon_id=self.instance.id,
            license=amo.LICENSE_CC_BY.id, accentcolor='C0FFEE',
            textcolor='EFFFFF')

    def test_initial(self):
        self.form = EditThemeOwnerForm(None, instance=self.instance)
        assert self.form.initial == {}

        self.instance.addonuser_set.create(user_id=999)
        assert self.instance.addonuser_set.all()[0].user.email == (
            '[email protected]')
        self.form = EditThemeOwnerForm(None, instance=self.instance)
        assert self.form.initial == {'owner': '[email protected]'}

    def test_success_change_from_no_owner(self):
        self.form = EditThemeOwnerForm({'owner': '[email protected]'},
                                       instance=self.instance)
        assert self.form.is_valid(), self.form.errors
        self.form.save()
        assert self.instance.addonuser_set.all()[0].user.email == (
            '[email protected]')

    def test_success_replace_owner(self):
        self.instance.addonuser_set.create(user_id=999)
        self.form = EditThemeOwnerForm({'owner': '[email protected]'},
                                       instance=self.instance)
        assert self.form.is_valid(), self.form.errors
        self.form.save()
        assert self.instance.addonuser_set.all()[0].user.email == (
            '[email protected]')

    def test_error_invalid_user(self):
        self.form = EditThemeOwnerForm({'owner': '[email protected]'},
                                       instance=self.instance)
        assert not self.form.is_valid()
开发者ID:tsl143,项目名称:addons-server,代码行数:45,代码来源:test_forms.py

示例6: TestEditThemeOwnerForm

class TestEditThemeOwnerForm(TestCase):
    fixtures = ["base/users"]

    def setUp(self):
        super(TestEditThemeOwnerForm, self).setUp()
        self.instance = Addon.objects.create(
            type=amo.ADDON_PERSONA,
            status=amo.STATUS_PUBLIC,
            slug="swag-overload",
            name="Bands Make Me Dance",
            description="tha description",
        )
        Persona.objects.create(
            persona_id=0,
            addon_id=self.instance.id,
            license=amo.LICENSE_CC_BY.id,
            accentcolor="C0FFEE",
            textcolor="EFFFFF",
        )

    def test_initial(self):
        self.form = EditThemeOwnerForm(None, instance=self.instance)
        assert self.form.initial == {}

        self.instance.addonuser_set.create(user_id=999)
        assert self.instance.addonuser_set.all()[0].user.email == ("[email protected]")
        self.form = EditThemeOwnerForm(None, instance=self.instance)
        assert self.form.initial == {"owner": "[email protected]"}

    def test_success_change_from_no_owner(self):
        self.form = EditThemeOwnerForm({"owner": "[email protected]"}, instance=self.instance)
        assert self.form.is_valid(), self.form.errors
        self.form.save()
        assert self.instance.addonuser_set.all()[0].user.email == ("[email protected]")

    def test_success_replace_owner(self):
        self.instance.addonuser_set.create(user_id=999)
        self.form = EditThemeOwnerForm({"owner": "[email protected]"}, instance=self.instance)
        assert self.form.is_valid(), self.form.errors
        self.form.save()
        assert self.instance.addonuser_set.all()[0].user.email == ("[email protected]")

    def test_error_invalid_user(self):
        self.form = EditThemeOwnerForm({"owner": "[email protected]"}, instance=self.instance)
        assert not self.form.is_valid()
开发者ID:lavish205,项目名称:olympia,代码行数:45,代码来源:test_forms.py

示例7: test_error_invalid_user

 def test_error_invalid_user(self):
     self.form = EditThemeOwnerForm({'owner': '[email protected]'},
                                    instance=self.instance)
     assert not self.form.is_valid()
开发者ID:tsl143,项目名称:addons-server,代码行数:4,代码来源:test_forms.py


注:本文中的olympia.addons.forms.EditThemeOwnerForm类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。