old_contents: """
  This file demonstrates writing tests using the unittest module. These will pass
  when you run "manage.py test".
  
  Replace this with more appropriate tests for your application.
  """
  
  from django.test import TestCase
  
  
  class SimpleTest(TestCase):
      def test_basic_addition(self):
          """
          Tests that 1 + 1 always equals 2.
          """
          self.assertEqual(1 + 1, 2)
  
new_contents: from django.test import TestCase
  from django.core.urlresolvers import reverse
  
  class AccountTest(TestCase):
      fixtures = ['auth.json', 'publicbodies.json', 'foirequest.json']
  
      def test_account_page(self):
          ok = self.client.login(username='sw', password='wrong')
          self.assertFalse(ok)
          ok = self.client.login(username='sw', password='froide')
          response = self.client.get(reverse('account-show'))
          self.assertEqual(response.status_code, 200)
  
      def test_login_page(self):
          self.client.logout()
          response = self.client.get(reverse('account-show'))
          self.assertEqual(response.status_code, 403)
          self.client.get(reverse('account-login'))
          response = self.client.post(reverse('account-login'),
                  {"email": "doesnt@exist.com",
                  "password": "foobar"})
          self.assertEqual(response.status_code, 400)
          response = self.client.post(reverse('account-login'),
                  {"email": "mail@stefanwehrmeyer.com",
                  "password": "dummy"})
          self.assertEqual(response.status_code, 400)
          response = self.client.post(reverse('account-login'),
                  {"email": "mail@stefanwehrmeyer.com",
                  "password": "froide"})
          self.assertEqual(response.status_code, 302)
          response = self.client.get(reverse('account-show'))
          self.assertEqual(response.status_code, 200)
          response = self.client.get(reverse('account-logout'))
          self.assertEqual(response.status_code, 302)
          response = self.client.get(reverse('account-login') + "?simple")
          self.assertIn("simple_base.html", map(lambda x: x.name, response.templates))
          response = self.client.post(reverse('account-login') + "?simple",
                  {"email": "mail@stefanwehrmeyer.com",
                  "password": "froide"})
          self.assertTrue(response.status_code, 302)
          self.assertIn("simple", response['location'])
  
subject: Test account pages