示例#1
0
    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)
示例#2
0
    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()
示例#3
0
    def test_create_entry_blanked_failure(self):
        entry = Entry()

        with self.assertRaises(ValidationError):
            entry.full_clean()