18.8. Tests Fixtures
from django.test import TestCase
from shop.models import Customer
class CustomerTests(TestCase):
fixtures = ['customers.json']
def test_customer_exists(self):
mark = Customer.objects.get(firstname='Mark', lastname='Watney')
self.assertEqual(mark.pk, 1)
self.assertEqual(mark.firstname, 'Mark')
self.assertEqual(mark.lastname, 'Watney')