コード例 #1
0
    def test_save_model(self):
        user = User.objects.create_user('foo', 'bar')
        request = RequestFactory().get('/')
        request.user = user

        category_admin = CategoryAdmin(Category, admin)
        category_admin.save_model(request, self.category1, None, None)
        saved_category = Category.objects.get(pk=self.category1.pk)
        self.assertEqual(saved_category.last_author, user)
コード例 #2
0
 def test_derivatives(self):
     category_admin = CategoryAdmin(Category, admin)
     self.assertEqual(category_admin._derivatives(self.category1), 1)
     self.assertEqual(category_admin._derivatives(self.category2), 0)