运行“python manage.py test”后出现奇怪的错误
django.db.utils.OperationalError: Problem installing fixture
'/home/voxa/django/test_test/resume/fixtures/initial_data.json': Could not load
resume.Person(pk=1): no such table: resume_person
但我使用了与“python manage.py loaddata initial_data.json”相同的装置
升级版:
测试.py
from django.test import TestCase
from django.test import Client
from resume.models import Person
class ResumeTest(TestCase):
def test_model(self):
bio = Person(first_name="Homer", last_name="Simpson", birth_date="04.02.1978", email="mail@gmail.com", jabber="jabber@jabbim.com", skype="skype", other_contacts="tel: +380975322155", bio="Was born...")
def test_index(self):
client = Client()
response = client.get('/')
self.assertEqual(response.status_code, 200)
self.assertContains(response, "Volodymyr")