def create_tolerance(tol_type=models.ABSOLUTE, act_low=-2, tol_low=-1, tol_high=1, act_high=2, created_by=None, mc_pass_choices='', mc_tol_choices=''): if created_by is None: created_by = create_user() kwargs = dict( type=tol_type, act_low=act_low, tol_low=tol_low, tol_high=tol_high, act_high=act_high, created_by=created_by, modified_by=created_by ) if tol_type == models.MULTIPLE_CHOICE: kwargs = dict( type=tol_type, mc_tol_choices=mc_tol_choices, mc_pass_choices=mc_pass_choices, created_by=created_by, modified_by=created_by ) tol = models.Tolerance(**kwargs) tol.save() return tol
def setUp(self): self.tests = [] self.ref = models.Reference(type=models.NUMERICAL, value=100.) self.tol = models.Tolerance(type=models.PERCENT, act_low=-3, tol_low=-2, tol_high=2, act_high=3) self.values = [None, None, 96, 97, 100, 100] self.statuses = [ utils.create_status(name="status%d" % x, slug="status%d" % x) for x in range(len(self.values)) ] self.test_list = utils.create_test_list() for i in range(6): test = utils.create_test(name="name%d" % i) self.tests.append(test) utils.create_test_list_membership(self.test_list, test) self.unit_test_collection = utils.create_unit_test_collection( test_collection=self.test_list) self.test_list_instance = self.create_test_list_instance() self.group = models.Group.objects.get(pk=1) user = models.User.objects.get(pk=1) user.groups.add(self.group) user.email = "*****@*****.**" user.save()