new_contents: import os
  import shutil
  
  from datetime import timedelta
  
  from django.contrib.auth.models import User
  from django.core.files.uploadedfile import SimpleUploadedFile
  from django.test import TestCase
  from django.utils import timezone
  
  from challenges.models import Challenge, ChallengePhase
  from hosts.models import ChallengeHostTeam
  from jobs.models import Submission
  from participants.models import ParticipantTeam
  
  
  class BaseTestCase(TestCase):
  
      def setUp(self):
          self.user = User.objects.create(
              username='user',
              email='user@test.com',
              password='password')
          self.participant_team = ParticipantTeam.objects.create(
              team_name='Participant Team for Challenge',
              created_by=self.user)
          self.challenge_host_team = ChallengeHostTeam.objects.create(
              team_name='Test Challenge Host Team',
              created_by=self.user)
          self.challenge = Challenge.objects.create(
              title='Test Challenge',
              description='Description for test challenge',
              terms_and_conditions='Terms and conditions for test challenge',
              submission_guidelines='Submission guidelines for test challenge',
              creator=self.challenge_host_team,
              start_date=timezone.now() - timedelta(days=2),
              end_date=timezone.now() + timedelta(days=1),
              published=False,
              enable_forum=True,
              anonymous_leaderboard=False)
  
          try:
              os.makedirs('/tmp/evalai')
          except OSError:
              pass
  
          with self.settings(MEDIA_ROOT='/tmp/evalai'):
              self.challenge_phase = ChallengePhase.objects.create(
                  name='Challenge Phase',
                  description='Description for Challenge Phase',
                  leaderboard_public=False,
                  is_public=True,
                  start_date=timezone.now() - timedelta(days=2),
                  end_date=timezone.now() + timedelta(days=1),
                  challenge=self.challenge,
                  test_annotation=SimpleUploadedFile('test_sample_file.txt',
                                                     'Dummy file content', content_type='text/plain')
              )
  
      def tearDown(self):
          shutil.rmtree('/tmp/evalai')
  
  
  class SubmissionTestCase(BaseTestCase):
  
      def setUp(self):
          super(SubmissionTestCase, self).setUp()
  
          self.submission = Submission.objects.create(
              participant_team=self.participant_team,
              challenge_phase=self.challenge_phase,
              created_by=self.challenge_host_team.created_by,
              status='submitted',
              input_file=self.challenge_phase.test_annotation,
              is_public=True,
          )
  
      def test__str__(self):
          self.assertEqual('{}'.format(self.submission.id), self.submission.__str__())
  
subject: Add tests for __unicode__ functions in model. (#1025)