old_contents: from test_base import MainTestCase
  from main.models import UserProfile
  from django.core.urlresolvers import reverse
  from main.views import profile_settings
  
  class TestUserSettings(MainTestCase):
  
      def setUp(self):
          MainTestCase.setUp(self)
          self.settings_url = reverse(profile_settings, kwargs={'username': self.user.username})
  
      def test_render_user_settings(self):
          response = self.client.get(self.settings_url)
          self.assertEqual(response.status_code, 200)
  
      def test_show_existing_profile_data(self):
          profile, created = UserProfile.objects.get_or_create(user=self.user)
          profile.name = "Bobby"
          profile.save()
          response = self.client.get(self.settings_url)
          self.assertContains(response, profile.name)
  
      def test_update_user_settings(self):
          post_data = {
              'name': 'Bobby',
              'organization': 'Bob Inc',
              'city': 'Bobville',
              'country': 'BB',
              'twitter': 'bobo',
              'home_page': 'bob.com',
          }
          response = self.client.post(self.settings_url, post_data)
          self.assertEqual(response.status_code, 302)
          for key, value in post_data.iteritems():
              self.assertEqual(self.user.profile.__dict__[key], value)
  
  
new_contents: from test_base import MainTestCase
  from main.models import UserProfile
  from django.core.urlresolvers import reverse
  from main.views import profile_settings
  
  class TestUserSettings(MainTestCase):
  
      def setUp(self):
          MainTestCase.setUp(self)
          self.settings_url = reverse(profile_settings, kwargs={'username': self.user.username})
  
      def test_render_user_settings(self):
          response = self.client.get(self.settings_url)
          self.assertEqual(response.status_code, 200)
  
      def test_show_existing_profile_data(self):
          profile, created = UserProfile.objects.get_or_create(user=self.user)
          profile.name = "Bobby"
          profile.save()
          response = self.client.get(self.settings_url)
          self.assertContains(response, profile.name)
  
      def test_update_user_settings(self):
          post_data = {
              'name': 'Bobby',
              'organization': 'Bob Inc',
              'city': 'Bobville',
              'country': 'BB',
              'twitter': 'bobo',
              'home_page': 'bob.com',
              'require_auth': True,
          }
          response = self.client.post(self.settings_url, post_data)
          self.assertEqual(response.status_code, 302)
          for key, value in post_data.iteritems():
              self.assertEqual(self.user.profile.__dict__[key], value)
  
  
subject: add require_auth to the user settings test