def test_robot_uuid_value(app): with app.app_context(): with raises(ValidationError): RobotUUID(RobotSerialNumber({})).value RobotUUID(RobotSerialNumber({"test": "another test"})).value with raises(RetrievalError): RobotUUID(RobotSerialNumber({FIELD_EVENT_ROBOT: "1234"})).value uuid = app.config["BIOSERO_ROBOTS"]["CPA"]["uuid"] assert RobotUUID(RobotSerialNumber({FIELD_EVENT_ROBOT: "CPA"})).value == uuid
def initialize_event(self, params: Dict[str, str]) -> None: super().initialize_event(params=params) self._event_type = params["event_type"] self.properties["plate_barcode"] = PlateBarcode(params) self.properties["failure_type"] = FailureType(params) self.properties["user_id"] = UserID(params) for property_name in ["plate_barcode", "failure_type", "user_id"]: self.properties[property_name].is_valid() self.properties["destination_plate"] = self.properties["plate_barcode"] self.properties["wells"] = WellsFromDestination( self.properties["plate_barcode"]) self.properties["source_plates"] = SourcePlatesFromDestination( self.properties["wells"]) self.properties["samples"] = SamplesFromDestination( self.properties["wells"]) self.properties["samples_with_cog_uk_id"] = SamplesWithCogUkId( self.properties["samples"]) self.properties["controls"] = ControlsFromDestination( self.properties["wells"]) self.properties["run_id"] = RunIDFromWells(self.properties["wells"]) self.properties["run_info"] = RunInfo(self.properties["run_id"]) self.properties["automation_system_name"] = AutomationSystemName( self.properties["run_info"]) self.properties["robot_uuid"] = RobotUUID( self.properties["automation_system_name"])
def initialize_event(self, params: Dict[str, str]) -> None: super().initialize_event(params=params) self._event_type = params["event_type"] self.properties["run_id"] = RunID(params) for property_name in ["run_id"]: self.properties[property_name].is_valid() self.properties["run_info"] = RunInfo(self.properties["run_id"]) self.properties["user_id"] = UserID(self.properties["run_info"]) self.properties["automation_system_name"] = AutomationSystemName(self.properties["run_info"]) self.properties["robot_uuid"] = RobotUUID(self.properties["automation_system_name"])
def test_robot_uuid_errors(app): with app.app_context(): # After success robot = RobotUUID(RobotSerialNumber({FIELD_EVENT_ROBOT: "CPA"})) robot.value assert len(robot.errors) == 0 # After is_valid false robot = RobotUUID(RobotSerialNumber({FIELD_EVENT_ROBOT: "12 34"})) robot.is_valid() assert len(robot.errors) > 0 # After retrieval error robot = RobotUUID(RobotSerialNumber({FIELD_EVENT_ROBOT: "1234"})) with raises(RetrievalError): robot.value assert len(robot.errors) > 0
def initialize_event(self, params: Dict[str, str]) -> None: super().initialize_event(params=params) self._event_type = params["event_type"] self.properties["plate_barcode"] = PlateBarcode(params) self.properties["run_id"] = RunID(params) for property_name in ["plate_barcode", "run_id"]: self.properties[property_name].is_valid() self.properties["run_info"] = RunInfo(self.properties["run_id"]) self.properties["source_plate_uuid"] = SourcePlateUUID(self.properties["plate_barcode"]) self.properties["user_id"] = UserID(self.properties["run_info"]) self.properties["automation_system_name"] = AutomationSystemName(self.properties["run_info"]) self.properties["robot_uuid"] = RobotUUID(self.properties["automation_system_name"]) self.properties["all_samples"] = SamplesFromSource(self.properties["plate_barcode"])
def initialize_event(self, params: Dict[str, str]) -> None: super().initialize_event(params=params) self._event_type = params["event_type"] self.properties["plate_barcode"] = PlateBarcode(params) self.properties["run_id"] = RunID(params) for property_name in ["plate_barcode", "run_id"]: self.properties[property_name].is_valid() self.properties["run_info"] = RunInfo(self.properties["run_id"]) self.properties["user_id"] = UserID(self.properties["run_info"]) self.properties["automation_system_name"] = AutomationSystemName( self.properties["run_info"]) self.properties["robot_uuid"] = RobotUUID( self.properties["automation_system_name"]) self.properties["barcode_no_plate_map_data"] = BarcodeNoPlateMapData( params)
def test_robot_uuid_is_valid(app): assert RobotUUID(RobotSerialNumber({})).is_valid() is False assert RobotUUID(RobotSerialNumber({"test": "another test"})).is_valid() is False assert RobotUUID(RobotSerialNumber({FIELD_EVENT_ROBOT: "1234"})).is_valid() is True
def test_robot_uuid_new(app): assert RobotUUID(RobotSerialNumber({})) is not None assert RobotUUID(RobotSerialNumber({"test": "a test"})) is not None assert RobotUUID(RobotSerialNumber({FIELD_EVENT_ROBOT: "a test"})) is not None