text: from django.test import TestCase
  
  # Create your tests here.
  import datetime
  import sha
  
  from django.conf import settings
  from django.contrib.auth.models import User
  from django.core import mail
  from django.core import management
  from django.core.urlresolvers import reverse
  from django.test import TestCase
  
  from registration import forms
  from registration.models import RegistrationProfile
  
  
  class RegistrationTestCase(TestCase):
      """
      Base class for the test cases; this sets up two users -- one
      expired, one not -- which are used to exercise various parts of
      the application.
      
      """
      def setUp(self):
          self.sample_user = RegistrationProfile.objects.create_inactive_user(username='alice',
                                                                              password='secret',
                                                                              email='alice@example.com')
          self.expired_user = RegistrationProfile.objects.create_inactive_user(username='bob',
                                                                               password='swordfish',
                                                                               email='bob@example.com')
          self.expired_user.date_joined -= datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS + 1)
          self.expired_user.save()
  
  
  class RegistrationModelTests(RegistrationTestCase):
      """
      Tests for the model-oriented functionality of django-registration,
      including ``RegistrationProfile`` and its custom manager.
      
      """
      def test_new_user_is_inactive(self):
          """
          Test that a newly-created user is inactive.
          
          """
          self.failIf(self.sample_user.is_active)
  
      def test_registration_profile_created(self):
          """
          Test that a ``RegistrationProfile`` is created for a new user.
          
          """
          self.assertEqual(RegistrationProfile.objects.count(), 2)
  