Esempio n. 1
0
 def test_bar_can_have_two_tabs(self):
     self.room1 = Room("Room 1", 5, 5)
     self.room2 = Room("Room 2", 10, 3)
     self.bar.start_tab(self.room1)
     self.bar.start_tab(self.room2)
     self.assertEqual(False, bool(self.bar.tab_list[self.room1.name]))
     self.assertEqual(False, bool(self.bar.tab_list[self.room2.name]))
Esempio n. 2
0
 def test_room_can_request_total_cost_of_tab(self):
     self.room1 = Room("Room 1", 5, 5)
     self.guest = Guest("John", 50, "Hello")
     self.drink1 = Drink("Peroni", 5)
     self.drink2 = Drink("Cobra", 4)
     self.room1.checkIn(self.guest)
     self.bar.add_drink_to_stock(self.drink1, 10)
     self.bar.add_drink_to_stock(self.drink2, 10)
     self.bar.start_tab(self.room1)
     self.bar.order_drink(self.drink1, self.room1)
     self.bar.order_drink(self.drink2, self.room1)
     self.assertEqual(9, self.bar.request_tab_cost(self.room1))
Esempio n. 3
0
    def setUp(self):
        self.room1 = Room("POP-pin Bottles", "Pop", 6, 15)
        self.room2 = Room("Screamo If You Want More", "Metal", 4, 10)
        self.room3 = Room("Timewarp", "Golden Oldies", 8, 20)
        self.room4 = Room("Get Lowww", "Rap", 4, 10)

        self.guest1 = Guest("Stuart", 25, "Golden Oldies", 40)
        self.guest2 = Guest("Rhian", 25, "Pop", 40)
        self.guest3 = Guest("Michael", 24, "Pop", 60)
        self.guest4 = Guest("Emma", 25, "Pop", 30)
        self.guest5 = Guest("Liam", 25, "Rap", 50)
        self.guest6 = Guest("Caragh", 26, "Metal", 5)
        self.guest7 = Guest("Andrew", 25, "Metal", 40)
        self.guest8 = Guest("Mirza", 25, "Rap", 75)
        self.guest9 = Guest("Lisa", 26, "Golden Oldies", 50)
        self.guest10 = Guest("Alexa Bliss", 29, "Metal", 100)

        self.song1 = Song("Angels", "Robbie Williams", "Pop")
        self.song2 = Song("C'est La Vie", "Bewitched", "Pop")
        self.song3 = Song("Holy Diver", "Dio", "Metal")
        self.song4 = Song("Run To The Hills", "Iron Maiden", "Metal")
        self.song5 = Song("Dreams", "Fleetwood Mac", "Golden Oldies")
        self.song6 = Song("Hotel California", "Eagles", "Golden Oldies")
        self.song7 = Song("Till The End", "Logic", "Rap")
        self.song8 = Song("No Role Modelz", "J. Cole", "Rap")
Esempio n. 4
0
 def test_customer_add_two_drinks_to_tab(self):
     self.guest = Guest("Ben", 50, "Purple Rain")
     self.drink = Drink("Peroni", 5)
     self.newRoom = Room("DrinkRoom", 10, 10)
     self.bar.add_drink_to_stock(self.drink, 50)
     self.bar.start_tab(self.newRoom)
     self.bar.order_drink(self.drink, self.newRoom)
     self.bar.order_drink(self.drink, self.newRoom)
     self.assertEqual(2, self.bar.tab_list[self.newRoom.name][self.drink])
Esempio n. 5
0
 def test_customer_can_order_a_drink_and_add_to_bar_tab(self):
     self.guest = Guest("Ben", 50, "Purple Rain")
     self.drink = Drink("Peroni", 5)
     self.newRoom = Room("DrinkRoom", 10, 10)
     self.bar.add_drink_to_stock(self.drink, 50)
     self.bar.start_tab(self.newRoom)
     self.bar.order_drink(self.drink, self.newRoom)
     self.assertEqual(1, self.bar.tab_list[self.newRoom.name][self.drink])
     self.assertEqual(50, self.guest.wallet)
     self.assertEqual(0, self.newRoom.total_cash)
Esempio n. 6
0
    def setUp(self):
        self.song_1 = Song("Sympathy for the Devil", "Rolling Stones")
        self.song_2 = Song("All Along the Watchtower", "Jimi Hendrix")
        self.song_3 = Song("Jumping Jack Flash", "Rolling Stones")
        self.song_4 = Song("Gangnam Sytle", "Psy")
        self.song_5 = Song("Fake Love", "BTS")
        self.song_6 = Song("Come Together", "The Beatles")

        self.guest_1 = Guest("Fred Smith", 50, 'Gangham Style')
        self.guest_2 = Guest("Cynthia Applebaum", 20,
                             "All Along the Watchtower")

        songs = [self.song_1, self.song_2, self.song_3, self.song_6]
        songs_1 = [self.song_4, self.song_5]
        guests = [self.guest_1, self.guest_2]
        guests_1 = []
        self.room_1 = Room("Songs of the Sixties", guests, songs, 2,
                           len(guests) * 20)
        self.room_2 = Room("K-pop", guests_1, songs_1, 3, 0)
Esempio n. 7
0
class TestBar(unittest.TestCase):
    def setUp(self):
        self.bar = Bar("Main Bar")

    def test_bar_has_name(self):
        self.assertEqual("Main Bar", self.bar.name)

    def test_bar_starts_with_empty_stock(self):
        self.assertEqual(0, len(self.bar.stock))

    def test_bar_can_add_drinks_to_stock(self):
        self.drink = Drink("Peroni", 5)
        self.bar.add_drink_to_stock(self.drink, 50)
        self.assertEqual(50, self.bar.stock[self.drink])

    def test_bar_can_add_existing_drinks(self):
        self.drink = Drink("Peroni", 5)
        self.bar.add_drink_to_stock(self.drink, 50)
        self.bar.add_drink_to_stock(self.drink, 50)
        self.assertEqual(100, self.bar.stock[self.drink])

    def test_bar_has_empty_tab(self):
        self.newRoom = Room("New Room", 5, 5)
        self.bar.start_tab(self.newRoom)
        self.assertEqual(False, bool(self.bar.tab_list[self.newRoom.name]))

    def test_customer_can_order_a_drink_and_add_to_bar_tab(self):
        self.guest = Guest("Ben", 50, "Purple Rain")
        self.drink = Drink("Peroni", 5)
        self.newRoom = Room("DrinkRoom", 10, 10)
        self.bar.add_drink_to_stock(self.drink, 50)
        self.bar.start_tab(self.newRoom)
        self.bar.order_drink(self.drink, self.newRoom)
        self.assertEqual(1, self.bar.tab_list[self.newRoom.name][self.drink])
        self.assertEqual(50, self.guest.wallet)
        self.assertEqual(0, self.newRoom.total_cash)

    def test_customer_add_two_drinks_to_tab(self):
        self.guest = Guest("Ben", 50, "Purple Rain")
        self.drink = Drink("Peroni", 5)
        self.newRoom = Room("DrinkRoom", 10, 10)
        self.bar.add_drink_to_stock(self.drink, 50)
        self.bar.start_tab(self.newRoom)
        self.bar.order_drink(self.drink, self.newRoom)
        self.bar.order_drink(self.drink, self.newRoom)
        self.assertEqual(2, self.bar.tab_list[self.newRoom.name][self.drink])

    def test_add_two_different_drinks_to_tab(self):
        self.guest = Guest("Ben", 50, "Purple Rain")
        self.drink = Drink("Peroni", 5)
        self.drink2 = Drink("Cobra", 4)
        self.newRoom = Room("DrinkRoom", 10, 10)
        self.bar.add_drink_to_stock(self.drink, 50)
        self.bar.add_drink_to_stock(self.drink2, 50)
        self.bar.start_tab(self.newRoom)
        self.bar.order_drink(self.drink, self.newRoom)
        self.bar.order_drink(self.drink2, self.newRoom)
        self.assertEqual(1, self.bar.tab_list[self.newRoom.name][self.drink])
        self.assertEqual(1, self.bar.tab_list[self.newRoom.name][self.drink2])

    def test_room_can_start_a_tab(self):
        self.newRoom = Room("New Room", 10, 5)
        self.bar.start_tab(self.newRoom)
        self.assertEqual(False, bool(self.bar.tab_list[self.newRoom.name]))

    def test_bar_can_have_two_tabs(self):
        self.room1 = Room("Room 1", 5, 5)
        self.room2 = Room("Room 2", 10, 3)
        self.bar.start_tab(self.room1)
        self.bar.start_tab(self.room2)
        self.assertEqual(False, bool(self.bar.tab_list[self.room1.name]))
        self.assertEqual(False, bool(self.bar.tab_list[self.room2.name]))

    def test_room_can_request_total_cost_of_tab(self):
        self.room1 = Room("Room 1", 5, 5)
        self.guest = Guest("John", 50, "Hello")
        self.drink1 = Drink("Peroni", 5)
        self.drink2 = Drink("Cobra", 4)
        self.room1.checkIn(self.guest)
        self.bar.add_drink_to_stock(self.drink1, 10)
        self.bar.add_drink_to_stock(self.drink2, 10)
        self.bar.start_tab(self.room1)
        self.bar.order_drink(self.drink1, self.room1)
        self.bar.order_drink(self.drink2, self.room1)
        self.assertEqual(9, self.bar.request_tab_cost(self.room1))
Esempio n. 8
0
 def test_room_can_start_a_tab(self):
     self.newRoom = Room("New Room", 10, 5)
     self.bar.start_tab(self.newRoom)
     self.assertEqual(False, bool(self.bar.tab_list[self.newRoom.name]))
Esempio n. 9
0
 def test_bar_has_empty_tab(self):
     self.newRoom = Room("New Room", 5, 5)
     self.bar.start_tab(self.newRoom)
     self.assertEqual(False, bool(self.bar.tab_list[self.newRoom.name]))
Esempio n. 10
0
class TestRoom(unittest.TestCase):
    def setUp(self):
        self.song_1 = Song("Sympathy for the Devil", "Rolling Stones")
        self.song_2 = Song("All Along the Watchtower", "Jimi Hendrix")
        self.song_3 = Song("Jumping Jack Flash", "Rolling Stones")
        self.song_4 = Song("Gangnam Sytle", "Psy")
        self.song_5 = Song("Fake Love", "BTS")
        self.song_6 = Song("Come Together", "The Beatles")

        self.guest_1 = Guest("Fred Smith", 50, 'Gangham Style')
        self.guest_2 = Guest("Cynthia Applebaum", 20,
                             "All Along the Watchtower")

        songs = [self.song_1, self.song_2, self.song_3, self.song_6]
        songs_1 = [self.song_4, self.song_5]
        guests = [self.guest_1, self.guest_2]
        guests_1 = []
        self.room_1 = Room("Songs of the Sixties", guests, songs, 2,
                           len(guests) * 20)
        self.room_2 = Room("K-pop", guests_1, songs_1, 3, 0)

    def test_room_has_guest_alt(self):
        self.assertEqual(2, len(self.room_1.guests))

    def test_room_has_song(self):
        self.assertEqual(4, len(self.room_1.songs))

    def test_guest_added_to_room(self):
        new_guest = Guest("Joe Bloggs", 100, "Sympathy for the Devil")
        self.room_2.add_guest(new_guest)
        self.assertEqual(1, len(self.room_2.guests))

    def test_guest_removed_from_room(self):
        guest_to_remove = "Fred Smith"
        self.room_1.remove_guest(guest_to_remove)
        self.assertEqual(1, len(self.room_1.guests))

    def test_remove_all_guests_from_room(self):
        self.room_1.remove_all_guests()
        self.assertEqual(0, len(self.room_1.guests))

    def test_add_song_to_room(self):
        song_to_add = Song("Jumping Jack Flash", "Rolling Stones")
        self.room_2.add_song(song_to_add)
        self.assertEqual(3, len(self.room_2.songs))

    def test_remove_song_from_room_by_name(self):
        song_to_remove = "Sympathy for the Devil"
        self.room_1.remove_song(song_to_remove)
        self.assertEqual(3, len(self.room_1.songs))

    def test_find_if_guest_in_room_yes(self):
        guest_to_find = "Cynthia Applebaum"
        self.assertEqual(True, self.room_1.find_guest(guest_to_find))

    def test_find_if_guest_in_room_no(self):
        guest_to_find = "Elizabeth Windsor"
        self.assertEqual(False, self.room_1.find_guest(guest_to_find))

    def test_find_if_song_in_room_yes(self):
        song_to_find = "All Along the Watchtower"
        self.assertEqual(True, self.room_1.find_song(song_to_find))

    def test_find_if_song_in_room_no(self):
        song_to_find = "Gangham Style"
        self.assertEqual(False, self.room_1.find_song(song_to_find))

    def test_check_number_of_spaces(self):
        self.assertEqual("That room is full",
                         self.room_1.check_room_capacity())

    def test_check_guest_has_enough_money_refuse_entry(self):
        new_guest = Guest("Joe Bloggs", 10, "Sympathy for the Devil")
        self.assertEqual("Sorry, our rooms are £20",
                         self.room_2.add_guest(new_guest))

    def test_check_guest_has_enough_money_accept_entry(self):
        new_guest = Guest("Adam Jones", 20, "Come Together")
        self.room_2.add_guest(new_guest)
        self.assertEqual(1, len(self.room_2.guests))

    def test_guest_put_in_room_with_favourite_song_yes(self):
        new_guest = Guest("Archibald Constantinople", 100, "Fake Love")
        self.assertEqual("Whoo-hoo!", self.room_2.add_guest(new_guest))

    def test_guest_put_in_room_with_favourite_song_no(self):
        new_guest = Guest("Rachel Dawson", 40, "Halleluja")
        self.assertEqual("Boo!", self.room_2.add_guest(new_guest))

    def test_room_takings(self):
        self.assertEqual(40, self.room_1.takings)

    def test_add_guest_and_take_cash(self):
        new_guest = Guest("Rachel Dawson", 40, "Halleluja")
        self.room_2.add_guest(new_guest)
        self.assertEqual(20, self.room_2.takings)

    def test_refuse_guest_and_dont_take_cash(self):
        new_guest = Guest("Joe Bloggs", 10, "Sympathy for the Devil")
        self.room_2.add_guest(new_guest)
        self.assertEqual(0, self.room_2.takings)

    def test_guest_put_in_room_with_favourite_song_adds_tip(self):
        new_guest = Guest("Archibald Constantinople", 100, "Fake Love")
        self.room_2.add_guest(new_guest)
        self.assertEqual(25, self.room_2.takings)
Esempio n. 11
0
class TestRoom(unittest.TestCase):
    def setUp(self):
        self.room1 = Room("POP-pin Bottles", "Pop", 6, 15)
        self.room2 = Room("Screamo If You Want More", "Metal", 4, 10)
        self.room3 = Room("Timewarp", "Golden Oldies", 8, 20)
        self.room4 = Room("Get Lowww", "Rap", 4, 10)

        self.guest1 = Guest("Stuart", 25, "Golden Oldies", 40)
        self.guest2 = Guest("Rhian", 25, "Pop", 40)
        self.guest3 = Guest("Michael", 24, "Pop", 60)
        self.guest4 = Guest("Emma", 25, "Pop", 30)
        self.guest5 = Guest("Liam", 25, "Rap", 50)
        self.guest6 = Guest("Caragh", 26, "Metal", 5)
        self.guest7 = Guest("Andrew", 25, "Metal", 40)
        self.guest8 = Guest("Mirza", 25, "Rap", 75)
        self.guest9 = Guest("Lisa", 26, "Golden Oldies", 50)
        self.guest10 = Guest("Alexa Bliss", 29, "Metal", 100)

        self.song1 = Song("Angels", "Robbie Williams", "Pop")
        self.song2 = Song("C'est La Vie", "Bewitched", "Pop")
        self.song3 = Song("Holy Diver", "Dio", "Metal")
        self.song4 = Song("Run To The Hills", "Iron Maiden", "Metal")
        self.song5 = Song("Dreams", "Fleetwood Mac", "Golden Oldies")
        self.song6 = Song("Hotel California", "Eagles", "Golden Oldies")
        self.song7 = Song("Till The End", "Logic", "Rap")
        self.song8 = Song("No Role Modelz", "J. Cole", "Rap")

        # guests = [self.guest1, self.guest2, self.guest3, self.guest4, self.guest5,
        # self.guest6, self.guest7, self.guest8, self.guest9, self.guest10]

    def test_rooms_have_names(self):
        self.assertEqual("Timewarp", self.room3.name)

    def test_rooms_have_genres(self):
        self.assertEqual("Pop", self.room1.genre)

    def test_rooms_have_capacities(self):
        self.assertEqual(4, self.room2.capacity)

    def test_add_guest_to_room(self):
        self.room1.add_guest_to_room(self.guest1)
        self.assertEqual(1, len(self.room1.guest_list))

    def test_if_room_full_KB(self):
        self.room2.guest_list = [
            self.guest1, self.guest2, self.guest3, self.guest4
        ]
        self.room2.if_room_full_KB(self.guest5)
        self.assertEqual(4, len(self.room2.guest_list))

    def test_guest_leaves_room(self):
        self.room1.guest_list = [
            self.guest1, self.guest2, self.guest3, self.guest4
        ]
        self.room1.guest_leaves_room(self.guest1)
        self.assertEqual(3, len(self.room1.guest_list))

    def test_add_song_to_room(self):
        self.room3.add_song_to_room(self.song5)
        self.assertEqual(1, len(self.room3.song_list))

    def test_room_has_entry_fee(self):
        self.assertEqual(15, self.room1.entry_fee)

    def test_guest_can_afford_room__true(self):
        self.room1.guest_can_afford_room(self.guest1)
        self.assertEqual("Come on in!",
                         self.room1.guest_can_afford_room(self.guest1))

    def test_guest_can_afford_room__false(self):
        self.room3.guest_can_afford_room(self.guest6)
        self.assertEqual("Sorry mate, you can't afford this",
                         self.room3.guest_can_afford_room(self.guest6))