def test_source_plates_from_destination_add_to_warehouse(
    app,
    run_id,
    destination_barcode,
    samples_from_cherrytrack_into_mongo,
    mocked_responses,
    source_plates,
    cherrytrack_mock_destination_plate,
    cherrytrack_destination_plate_response,
):
    with app.app_context():
        instance = SourcePlatesFromDestination(
            WellsFromDestination(PlateBarcode({FIELD_EVENT_BARCODE: destination_barcode}))
        )

        message = WarehouseMessage("mytype", "myuuid", "at some point")
        instance.add_to_warehouse_message(message)
        assert message._subjects == [
            {
                "role_type": "cherrypicking_source_labware",
                "subject_type": "plate",
                "friendly_name": "plate_123",
                "uuid": "a17c38cd-b2df-43a7-9896-582e7855b4cc",
            }
        ]
Example #2
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["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 test_source_plates_from_destination_value_gets_value(
    app,
    run_id,
    destination_barcode,
    samples_from_cherrytrack_into_mongo,
    mocked_responses,
    source_plates,
    cherrytrack_mock_destination_plate,
    cherrytrack_destination_plate_response,
):
    with app.app_context():
        val = SourcePlatesFromDestination(
            WellsFromDestination(PlateBarcode({FIELD_EVENT_BARCODE: destination_barcode}))
        ).value

        for elem in val:
            del elem["_id"]

        assert val == [
            {"Lab ID": "lab_1", "barcode": "plate_123", "lh_source_plate_uuid": "a17c38cd-b2df-43a7-9896-582e7855b4cc"}
        ]