Exemplo n.º 1
0
    def setUp(self):
        super().setUp()
        self.maxDiff = None  # show full diff

        # setup users

        # setup super user
        self.superuser = self.make_user("superuser")
        self.superuser.is_staff = True
        self.superuser.is_superuser = True
        self.superuser.save()

        # setup contributor user
        self.contributor = self.make_user("contributor")

        # setup owner for projects, not used in tests
        owner = self.make_user("owner")

        # setup cases & projects & roles

        # project 1 case 1
        self.project1 = ProjectFactory()
        self.project1_case1, variant_set_1, _ = CaseWithVariantSetFactory.get(
            "small", project=self.project1)
        self.project1_case1_smallvars = SmallVariantFactory.create_batch(
            1, variant_set=variant_set_1)

        # project 1 case 2
        self.project1_case2, variant_set_2, _ = CaseWithVariantSetFactory.get(
            "small", project=self.project1)
        self.project1_case2_smallvars = SmallVariantFactory.create_batch(
            2, variant_set=variant_set_2)
        # project 2 case 1
        self.project2 = ProjectFactory()
        self.project2_case1, variant_set_3, _ = CaseWithVariantSetFactory.get(
            "small", project=self.project2)
        self.project2_case1_smallvars = SmallVariantFactory.create_batch(
            4, variant_set=variant_set_3)

        # project 2 case 2
        self.project2_case2, variant_set_4, _ = CaseWithVariantSetFactory.get(
            "small", project=self.project2)
        self.project2_case2_smallvars = SmallVariantFactory.create_batch(
            8, variant_set=variant_set_4)

        # init roles
        role_owner = Role.objects.get_or_create(name=PROJECT_ROLE_OWNER)[0]
        role_contributor = Role.objects.get_or_create(
            name=PROJECT_ROLE_CONTRIBUTOR)[0]

        # owner owns project1 and project2 (all projects)
        self._make_assignment(self.project1, owner, role_owner)
        self._make_assignment(self.project2, owner, role_owner)
        # contributor gets access to project2
        self._make_assignment(self.project2, self.contributor,
                              role_contributor)
 def setUp(self):
     super().setUp()
     user = self.make_user("superuser")
     self.bgjob = ProjectCasesFilterBgJobFactory(user=user)
     variant_sets = SmallVariantSetFactory.create_batch(
         2, case__project=self.bgjob.project)
     SmallVariantFactory.create_batch(3, variant_set=variant_sets[0])
     SmallVariantFactory.create_batch(3, variant_set=variant_sets[1])
     self.bgjob.projectcasessmallvariantquery.query_settings.update(
         vars(FormDataFactory(names=self.bgjob.project.get_members())))
Exemplo n.º 3
0
 def setUp(self):
     self.user = self.make_user("kiosk_user")
     self.category = ProjectFactory(
         title=settings.KIOSK_CAT,
         type=SODAR_CONSTANTS["PROJECT_TYPE_CATEGORY"])
     self.project_above_thres = ProjectFactory(
         title=settings.KIOSK_PROJ_PREFIX + str(uuid.uuid4()),
         parent=self.category)
     self.project_below_thres = ProjectFactory(
         title=settings.KIOSK_PROJ_PREFIX + str(uuid.uuid4()),
         parent=self.category)
     self.case_above_thres, self.variant_set_above_thres, _ = CaseWithVariantSetFactory.get(
         "small", project=self.project_above_thres)
     self.case_below_thres, self.variant_set_below_thres, _ = CaseWithVariantSetFactory.get(
         "small", project=self.project_below_thres)
     self.case_below_thres.date_created = datetime.now() - timedelta(
         weeks=9)
     self.case_below_thres.save()
     self.small_vars_above_thres = SmallVariantFactory.create_batch(
         3, variant_set=self.variant_set_above_thres)
     self.small_vars_below_thres = SmallVariantFactory.create_batch(
         3, variant_set=self.variant_set_below_thres)
Exemplo n.º 4
0
 def setUp(self):
     self.user = self.make_user("superuser")
     self.variant_set = SmallVariantSetFactory()
     self.small_vars = SmallVariantFactory.create_batch(3, variant_set=self.variant_set)
     self.case = self.variant_set.case
     self.bg_job = BackgroundJob.objects.create(
         name="job name",
         project=Project.objects.first(),
         job_type="variants.export_file_bg_job",
         user=self.user,
     )
     self.export_job = ExportFileBgJob.objects.create(
         project=self.bg_job.project,
         bg_job=self.bg_job,
         case=self.case,
         query_args={"export_flags": True, "export_comments": True},
         file_type="xlsx",
     )