コード例 #1
0
ファイル: test_sites.py プロジェクト: Frankie-666/wagtail
    def test_oops_there_is_more_than_one(self):
        Site.objects.create(hostname="example.com", is_default_site=True, root_page=Page.objects.get(pk=2))

        site = Site(hostname="test.com", is_default_site=True, root_page=Page.objects.get(pk=2))
        with self.assertRaises(Site.MultipleObjectsReturned):
            # If there already are multiple default sites, you're in trouble
            site.clean_fields()
コード例 #2
0
ファイル: test_sites.py プロジェクト: nwaxiomatic/PostVision
    def test_oops_there_is_more_than_one(self):
        Site.objects.create(hostname='example.com',
                            is_default_site=True,
                            root_page=Page.objects.get(pk=2))

        site = Site(hostname='test.com',
                    is_default_site=True,
                    root_page=Page.objects.get(pk=2))
        with self.assertRaises(Site.MultipleObjectsReturned):
            # If there already are multiple default sites, you're in trouble
            site.clean_fields()
コード例 #3
0
ファイル: test_sites.py プロジェクト: nwaxiomatic/PostVision
 def test_there_can_only_be_one(self):
     site = Site(hostname='test.com',
                 is_default_site=True,
                 root_page=Page.objects.get(pk=2))
     with self.assertRaises(ValidationError):
         site.clean_fields()
コード例 #4
0
ファイル: test_sites.py プロジェクト: jschneier/wagtail
 def test_there_can_only_be_one(self):
     site = Site(hostname='test.com', is_default_site=True,
                 root_page=Page.objects.get(pk=2))
     with self.assertRaises(ValidationError):
         site.clean_fields()