Ejemplo n.º 1
0
def test_unavailable():
    """Tests if bike available status is correctly changed to False"""

    bikemanager = BikeManager()
    bike = Bike('AAA', BikeType.BMX, BikeBrand.GIANT, True)
    bikemanager.unavailable(bike)
    assert bike.available == False
Ejemplo n.º 2
0
def test_get_bike_notok2():
    """Tests if a bike that does not exist can be rented"""

    bikemanager = BikeManager()
    bike = Bike('AAA', BikeType.BMX, BikeBrand.GIANT, True)
    bikemanager.add_bike(bike)
    rentedbike = bikemanager.get_bike(BikeType.COMMUTING)
    assert isinstance(rentedbike, Bike) == False
Ejemplo n.º 3
0
def test_get_bike_notok1():
    """Tests if a bike not available can be rented"""

    bikemanager = BikeManager()
    bike = Bike('AAA', BikeType.BMX, BikeBrand.GIANT, False)
    bikemanager.add_bike(bike)
    rentedbike = bikemanager.get_bike(BikeType.BMX)
    assert isinstance(rentedbike, Bike) == False
Ejemplo n.º 4
0
def test_available():
    """Tests if bike available status is correctly changed to true"""

    bikemanager = BikeManager()
    bike = Bike('AAA', BikeType.BMX, BikeBrand.GIANT, False)
    logging.warning('Created bike: ' + str(bike))
    bikemanager.available(bike)
    logging.warning('Bike available property changed to True')
    assert bike.available == True
Ejemplo n.º 5
0
def test_add_bike_ok():
    """Tests if a bike is added correctly to the manager"""

    bikemanager = BikeManager()
    bike = Bike('AAA', BikeType.BMX, BikeBrand.GIANT, True)

    size = len(bikemanager.bikes)
    bikemanager.add_bike(bike)
    newsize = len(bikemanager.bikes)

    assert (newsize < size) == False
Ejemplo n.º 6
0
def test_create_rent_ok():
    rent_manager = RentManager()
    customer_manager = CustomerManager()
    customer = customer_manager.create_customer('35025191', 'Julian',
                                                'Massolo', 'Mitre 182',
                                                '*****@*****.**',
                                                '222225', [])

    bike = Bike('AAA', BikeType.BMX, BikeBrand.GIANT, True)
    rent_manager.bikemanager.add_bike(bike)
    rent = rent_manager.create_rent('01/01/2019', '05/01/2019', RentType.DAY,
                                    customer, BikeType.BMX)
    assert isinstance(rent, Rent) == True
Ejemplo n.º 7
0
    def unavailable(self, bike: Bike):
        """Sets a bike's available property to False"""

        logging.info('Changing bike availability to false')
        bike.available = False
Ejemplo n.º 8
0
    def available(self, bike: Bike):
        """Sets a bike's available property to True"""

        logging.info('Changing bike availability to true')
        bike.available = True