當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。