def test_create_category(self): # Create the category category = Category() # Add the attributes category.name = 'python' category.description = 'The Python programming language' category.slug = 'python' # Save it category.save() # Check we can find it all_categories = Category.objects.all() self.assertEquals(len(all_categories), 1) only_category = all_categories[0] self.assertEquals(only_category, category) # Check attributes self.assertEquals(only_category.name, 'python') self.assertEquals(only_category.description, 'The Python programming language') self.assertEquals(only_category.slug, 'python')
def test_create_category(self): # Create the category category = Category() # Add attributes category.name = 'python' category.description = 'The Python programming language' category.slug = 'python' # Save it category.save() # Check we can find it all_categories = Category.objects.all() self.assertEquals(len(all_categories), 1) only_category = all_categories[0] self.assertEquals(only_category, category) # Check attributes self.assertEquals(only_category.name, 'python') self.assertEquals(only_category.description, 'The Python programming language') self.assertEquals(only_category.slug, 'python')