Example #1
0
    def test_get_all_equipments(self):
        bus = boostrap_test_app()

        nu: datetime = datetime(2021, 3, 31, 0, 0, 0, 0, tzinfo=timezone.utc)

        bus.handle(
            commands.AddEquipmentCommand(
                0,
                f"Test_Manufacturer",  # Manufacturer
                f"Test_Model",  # Model
                f"Test_Install_Location",  # Install Location
                nu.isoformat(),  # Need by Date
                None,  # Lead Time
                None,  # Vendor
                None,  # PO
            ))

        nuto = nu + timedelta(days=2, hours=12)

        bus.handle(
            commands.AddEquipmentCommand(
                1,
                f"Test_Manufacturer",  # Manufacturer
                f"Test_Model",  # Model
                f"Test_Install_Location",  # Install Location
                nu.isoformat(),  # Need by Date
                None,  # Lead Time
                None,  # Vendor
                None,  # PO
            ))

        records = bus.uow.equipments.get_all()
        assert len(records) == 2
Example #2
0
    def test_get_ordered(self):
        bus = boostrap_test_app()

        nu: datetime = datetime(2021, 3, 31, 0, 0, 0, 0)

        bus.handle(
            commands.AddEquipmentCommand(
                0,
                f"Test_Manufacturer",  # Manufacturer
                f"Test_Model",  # Model
                f"Test_Install_Location",  # Install Location
                nu,  # Need by Date
                None,  # Lead Time
                None,  # Vendor
                None,  # PO
            ))

        nuto = nu + timedelta(days=2)

        bus.handle(
            commands.AddEquipmentCommand(
                1,
                f"Test_Manufacturer",  # Manufacturer
                f"Test_Model",  # Model
                f"Test_Install_Location",  # Install Location
                nuto,  # Need by Date
                10,  # Lead Time
                None,  # Vendor
                None,  # PO
            ))

        nuthe = datetime.now() + timedelta(days=12)

        bus.handle(
            commands.AddEquipmentCommand(
                2,
                f"Test_Manufacturer",  # Manufacturer
                f"Test_Model",  # Model
                f"Test_Install_Location",  # Install Location
                nuthe,  # Need by Date
                10,  # Lead Time
                f"Test_Vendor",  # Vendor
                f"Test_PO",  # PO
            ))

        records = bus.uow.equipments.get_ordered()
        assert len(records) == 1
Example #3
0
    def test_get_equipment_by_model(self):
        bus = boostrap_test_app()

        nu: datetime = datetime(2021, 3, 31, 0, 0, 0, 0, tzinfo=timezone.utc)

        # add one
        bus.handle(
            commands.AddEquipmentCommand(
                0,
                f"Test_Manufacturer",  # Manufacturer
                f"Test_Model",  # Model
                f"Test_Install_Location",  # Install Location
                nu.isoformat(),  # Need by Date
                None,  # Lead Time
                None,  # Vendor
                None,  # PO
            ))

        records = bus.uow.equipments.get_by_model(f"Test_Model")
        assert len(records) == 1
Example #4
0
    def test_add_single_equipment(self):
        bus = boostrap_test_app()

        nu: datetime = datetime(2021, 3, 31, 0, 0, 0, 0, tzinfo=timezone.utc)

        # add one
        bus.handle(
            commands.AddEquipmentCommand(
                0,
                f"Test_Manufacturer",  # Manufacturer
                f"Test_Model",  # Model
                f"Test_Install_Location",  # Install Location
                nu.isoformat(),  # Need by Date
                None,  # Lead Time
                None,  # Vendor
                None,  # PO
            ))

        assert bus.uow.equipments.get_by_id(0) is not None
        assert bus.uow.committed