old_contents: #
  # Switch2bill-common License
  #
  # This Source Code Form is subject to the terms of the Mozilla Public
  # License, v. 2.0. If a copy of the MPL was not distributed with this file,
  # You can obtain one at http://mozilla.org/MPL/2.0/.
  #
  # Copyright (C) 2011-2012 Star2Billing S.L.
  #
  # The Initial Developer of the Original Code is
  # Arezqui Belaid <info@star2billing.com>
  #
  
  from django.contrib.auth.models import User
  from django.test import TestCase, Client
  import base64
  import unittest
  
  
  def build_test_suite_from(test_cases):
      """Returns a single or group of unittest test suite(s) that's ready to be
      run. The function expects a list of classes that are subclasses of
      TestCase.
  
      The function will search the module where each class resides and
      build a test suite from that class and all subclasses of it.
      """
      test_suites = []
      for test_case in test_cases:
          mod = __import__(test_case.__module__)
          components = test_case.__module__.split('.')
          for comp in components[1:]:
              mod = getattr(mod, comp)
          tests = []
          for item in mod.__dict__.values():
              if type(item) is type and issubclass(item, test_case):
                  tests.append(item)
          test_suites.append(unittest.TestSuite(map(unittest.TestLoader().\
          loadTestsFromTestCase, tests)))
  
      return unittest.TestSuite(test_suites)
  
  
  class BaseAuthenticatedClient(TestCase):
      """Common Authentication"""
  
      def setUp(self):
          """To create admin user"""
          self.client = Client()
          self.user =\
              User.objects.create_user('admin', 'admin@world.com', 'admin')
          self.user.is_staff = True
          self.user.is_superuser = True
          self.user.is_active = True
          self.user.save()
          auth = '%s:%s' % ('admin', 'admin')
          auth = 'Basic %s' % base64.encodestring(auth)
          auth = auth.strip()
          self.extra = {
              'HTTP_AUTHORIZATION': auth,
              }
          login = self.client.login(username='admin', password='admin')
          self.assertTrue(login)
  
new_contents: #
  # Switch2bill-common License
  #
  # This Source Code Form is subject to the terms of the Mozilla Public
  # License, v. 2.0. If a copy of the MPL was not distributed with this file,
  # You can obtain one at http://mozilla.org/MPL/2.0/.
  #
  # Copyright (C) 2011-2012 Star2Billing S.L.
  #
  # The Initial Developer of the Original Code is
  # Arezqui Belaid <info@star2billing.com>
  #
  
  from django.contrib.auth.models import User
  from django.test import TestCase, Client
  import base64
  import unittest
  
  
  def build_test_suite_from(test_cases):
      """Returns a single or group of unittest test suite(s) that's ready to be
      run. The function expects a list of classes that are subclasses of
      TestCase.
  
      The function will search the module where each class resides and
      build a test suite from that class and all subclasses of it.
      """
      test_suites = []
      for test_case in test_cases:
          mod = __import__(test_case.__module__)
          components = test_case.__module__.split('.')
          for comp in components[1:]:
              mod = getattr(mod, comp)
          tests = []
          for item in mod.__dict__.values():
              if type(item) is type and issubclass(item, test_case):
                  tests.append(item)
          test_suites.append(unittest.TestSuite(map(unittest.TestLoader().\
          loadTestsFromTestCase, tests)))
  
      return unittest.TestSuite(test_suites)
  
  
  class BaseAuthenticatedClient(TestCase):
      """Common Authentication"""
      fixtures = ['auth_user.json']
  
      def setUp(self):
          """To create admin user"""
          self.client = Client()
          self.user = User.objects.get(username='admin')
          auth = '%s:%s' % ('admin', 'admin')
          auth = 'Basic %s' % base64.encodestring(auth)
          auth = auth.strip()
          self.extra = {
              'HTTP_AUTHORIZATION': auth,
              }
          login = self.client.login(username='admin', password='admin')
          self.assertTrue(login)
  
subject: fix Testcase helper BaseAuthenticatedClient : add fixture auth_user