mardi 20 octobre 2015

Django AttributeError: object has no attribute 'assertContains'

I'm trying Django test fixtures from the official documentation, but my test class can't find assertContains.

from django.utils import unittest
from django.test import Client

class SimpleTest(unittest.TestCase):
    def setUp(self):
        self.client = Client()

    def test_details(self):
        response = self.client.post('/register',
                                    {'username': '123',
                                     'password': '123',
                                    follow=True)
        self.assertEqual(response.status_code, 200)

        self.assertContains(response, "Logout")
        self.assertNotContains(response, "Login")

Aucun commentaire:

Enregistrer un commentaire