def _blank_Exp(blankName): # create blank experiment if doesn't already exist try: ret = Experiment.objects.get(expName=blankName) except Experiment.DoesNotExist: kwargs = {} for field in Experiment._meta.fields: if field.name == 'expName': kwargs[field.name] = blankName elif field.name == 'date': kwargs[field.name] = datetime.now() elif not field.null: if field.get_internal_type() == 'CharField' or field.get_internal_type() == 'TextField': kwargs[field.name] = "" elif field.get_internal_type() == 'BooleanField': kwargs[field.name] = False elif field.get_internal_type() == 'IntegerField': kwargs[field.name] = 0 else: # only id should remain logging.debug(field.name, field.get_internal_type()) kwargs['cycles'] = 1 kwargs['flows'] = 1 kwargs['ftpStatus'] = 'Complete' ret = Experiment(**kwargs) ret.save() return ret
def _blank_Exp(blankName): # create blank experiment if doesn't already exist try: ret = Experiment.objects.get(expName=blankName) except Experiment.DoesNotExist: kwargs = {} for field in Experiment._meta.fields: if field.name == 'expName': kwargs[field.name] = blankName elif field.name == 'date': kwargs[field.name] = datetime.now() elif not field.null: if field.get_internal_type( ) == 'CharField' or field.get_internal_type() == 'TextField': kwargs[field.name] = "" elif field.get_internal_type() == 'BooleanField': kwargs[field.name] = False elif field.get_internal_type() == 'IntegerField': kwargs[field.name] = 0 else: # only id should remain logging.debug(field.name, field.get_internal_type()) kwargs['cycles'] = 1 kwargs['flows'] = 1 kwargs['ftpStatus'] = 'Complete' ret = Experiment(**kwargs) ret.save() return ret
def _blank_Exp(blankName): # create blank experiment if doesn't already exist try: ret = Experiment.objects.get(expName=blankName) except Experiment.DoesNotExist: kwargs = {} for field in Experiment._meta.fields: if field.name == "expName": kwargs[field.name] = blankName elif field.name == "date": kwargs[field.name] = datetime.now() elif not field.null: if field.get_internal_type() == "CharField" or field.get_internal_type() == "TextField": kwargs[field.name] = "" elif field.get_internal_type() == "BooleanField": kwargs[field.name] = False elif field.get_internal_type() == "IntegerField": kwargs[field.name] = 0 else: # only id should remain logging.debug(field.name, field.get_internal_type()) pass kwargs["cycles"] = 1 kwargs["flows"] = 1 kwargs["barcodeId"] = "" ret = Experiment(**kwargs) ret.save() return ret
def create_result(self): exp = Experiment() exp.date = datetime.now() exp.cycles = 0 exp.flows = 0 exp.unique = uuid.uuid1() exp.save() result = Results() result.resultsName = 'foo' result.experiment = exp result.processedCycles = 0 result.processedflows = 0 result.framesProcessed = 0 result.save() self.assertIsNotNone(result.id, 'Result id is None') return result