def test_ensure_views_are_positive(self): cat = Category(name="nakul", views=-1, likes=0) cat.save() self.assertEqual((cat.views >= 0), True)
def test_slug_line_creation(self): cat = Category(name = "Just another category") cat.save() self.assertEqual(cat.slug, "just-another-category")
def test_does_slug_field_work(self): from rangoapp.models import Category cat = Category(name='how do i create a slug in django') cat.save() self.assertEqual(cat.slug, 'how-do-i-create-a-slug-in-django')