Une collection organisée de snippets de code pour accélérer votre développement. Parcourez, recherchez et copiez en un clic.
python manage.py test
# tests.py
from django.test import TestCase
class MonTest(TestCase):
def test_basique(self):
self.assertEqual(1 + 1, 2)
# tests.py
class ArticleModelTest(TestCase):
def test_creation_article(self):
article = Article.objects.create(titre="Test")
self.assertEqual(str(article), "Test")
# tests.py
from django.urls import reverse
class HomePageTest(TestCase):
def test_vue_repond_correctement(self):
response = self.client.get(reverse('home'))
self.assertEqual(response.status_code, 200)