コード例 #1
0
ファイル: tests.py プロジェクト: powersurge360/construct-fire
    def test_create_entry_author_failure(self):
        entry = Entry()

        entry.title = "New Blog Entry"
        entry.intro = "Just a short introduction, don't mind me"
        entry.body = "How's it going buddy?"
        entry.published = "d"

        with self.assertRaises(IntegrityError):
            entry.save()
コード例 #2
0
ファイル: tests.py プロジェクト: powersurge360/construct-fire
    def test_create_entry_success(self):
        entry = Entry()

        entry.title = "New Blog Entry"
        entry.intro = "Just a short introduction, don't mind me"
        entry.body = "How's it going buddy?"
        entry.published = "d"

        entry.author = User.objects.get(username="******")

        entry.save()
        entry.full_clean()

        self.assertEqual(Entry.objects.count(), 1)

        entry = Entry.objects.get()
        self.assertEqual("New Blog Entry", entry.title)
        self.assertEqual("new-blog-entry", entry.slug)