def setUp(self):

        if not self.prepared:
            # Clean up first
            Object.objects.all().delete()
            User.objects.all().delete()

            # Create objects

            try:
                self.group = Group.objects.get(name='api_test')
            except Group.DoesNotExist:
                Group.objects.all().delete()
                self.group = Group(name='api_test')
                self.group.save()

            try:
                self.user = DjangoUser.objects.get(username=self.username)
                self.user.set_password(self.password)
                try:
                    self.profile = self.user.profile
                except Exception:
                    User.objects.all().delete()
                    self.user = DjangoUser(username=self.username, password='')
                    self.user.set_password(self.password)
                    self.user.save()
            except DjangoUser.DoesNotExist:
                User.objects.all().delete()
                self.user = DjangoUser(username=self.username, password='')
                self.user.set_password(self.password)
                self.user.save()

            try:
                perspective = Perspective.objects.get(name='default')
            except Perspective.DoesNotExist:
                Perspective.objects.all().delete()
                perspective = Perspective(name='default')
                perspective.set_default_user()
                perspective.save()

            ModuleSetting.set('default_perspective', perspective.id)

            self.contact_type = ContactType(name='api_test')
            self.contact_type.set_default_user()
            self.contact_type.save()

            self.contact = Contact(
                name='api_test', contact_type=self.contact_type)
            self.contact.set_default_user()
            self.contact.save()

            self.project = Project(
                name='api_test', manager=self.contact, client=self.contact)
            self.project.set_default_user()
            self.project.save()

            self.status = TaskStatus(name='api_test')
            self.status.set_default_user()
            self.status.save()

            self.milestone = Milestone(
                name='api_test', project=self.project, status=self.status)
            self.milestone.set_default_user()
            self.milestone.save()

            self.task = Task(
                name='api_test', project=self.project, status=self.status, priority=3)
            self.task.set_default_user()
            self.task.save()

            self.time_slot = TaskTimeSlot(
                task=self.task, details='api_test', time_from=datetime.now(), user=self.user.profile)
            self.time_slot.set_default_user()
            self.time_slot.save()

            self.parent = Project(name='api_test')
            self.parent.set_default_user()
            self.parent.save()

            self.parent_task = Task(
                name='api_test', project=self.project, status=self.status, priority=3)
            self.parent_task.set_default_user()
            self.parent_task.save()

            self.client = Client()

            self.prepared = True
Constructs a new EmailSettingsPOP object with the given arguments.
dataset/ETHPy150Open treeio/treeio/treeio/projects/api/tests.py/ProjectsAPITest.setUp--crossover with--dataset/ETHPy150Open acil-bwh/SlicerCIP/Scripted/attic/PicasaSnap/gdata/apps/emailsettings/data.py/EmailSettingsPop.__init__