def create_pumping_station(self):
        """Create a pumping station and save it to the database."""
        # Before we can create and save a PumpingStation, we have to set the
        # required fields.

        # If a required field refers to another model, we do not save that model
        # to the database, otherwise we would also have to create the required
        # fields of that model.
        open_water = OpenWater()
        open_water.pk = 1
        # If we do not set the pk field of the model or set it after we have
        # assigned the model to the PumpingStation, we get an IntegrityError.
        label = Label()
        label.pk = self.label_pk
        self.label_pk += 1

        pumping_station = PumpingStation()
        pumping_station.open_water = open_water
        pumping_station.label = label
        pumping_station.into = True
        pumping_station.computed_level_control = True
        pumping_station.percentage = 100
        pumping_station.save()

        return pumping_station
    def test_b(self):
        """Test no intake are available for level control.

        There is an intake available for level control but that belongs to
        another open water.
        """
        open_water = OpenWater()
        open_water.pk = 2
        intake = find_pumping_station_level_control(open_water, True)
        self.assertTrue(intake is None)
def test_no_intakes_or_pumps_exist():
    """Test no intakes or pumps exist."""
    open_water = OpenWater()
    open_water.pk = 1
    intake = find_pumping_station_level_control(open_water, True)
    assert intake is None