class TestBar(unittest.TestCase):
    def setUp(self):

        drink_1 = Drink("Guinness", 3, 3)
        drink_2 = Drink("Whiskey Sour", 6, 5)
        drink_3 = Drink("Tsingtao", 4, 3)
        
        drinks_list = [drink_1, drink_2, drink_3]

        self.bar_1 = Bar(500, drinks_list)

        self.song_1 = Song(10001, "Let's Make Love and Listen to Death from Above", "CSS", [3,30], 2005)
        self.song_4 = Song(10004, "Club Tropicana", "Wham!", [4, 28], 1983)

        self.guest_1 = Guest("Lovefoxxx", 36, 50, self.song_1)
        self.guest_2 = Guest("Britney Spears", 38, 100, self.song_4)

        self.room_1 = Room("Plush Paradise", 3)

    

    def test_bar_has_drinks(self):

        self.assertEqual(3, len(self.bar_1.drinks))
        self.assertIsInstance(self.bar_1.drinks[0], Drink)

    def test_active_rooms_starts_empty(self):
        self.assertEqual([], self.bar_1.active_rooms)

    def test_find_drink_by_name(self):
        found_drink = self.bar_1.find_drink_by_name("Guinness")
        self.assertEqual(found_drink.name, "Guinness")
        self.assertEqual(found_drink.price, 3)
        self.assertEqual(found_drink.alcohol_level, 3)
    def setUp(self):

        drink_1 = Drink("Guinness", 3, 3)
        drink_2 = Drink("Whiskey Sour", 6, 5)
        drink_3 = Drink("Tsingtao", 4, 3)

        drinks_list = [drink_1, drink_2, drink_3]

        self.room_1 = Room("Plush Paradise", 3)
        self.bar_1 = Bar(500, drinks_list)

        self.venue_1 = Venue("Cara's OK Karaoke", [self.room_1], self.bar_1)

        self.song_1 = Song(10001,
                           "Let's Make Love and Listen to Death from Above",
                           "CSS", [3, 30], 2005)
        self.song_2 = Song(10002, "Song 2", "Blur", [2, 2], 1996)
        self.song_3 = Song(10003, "E-Mail My Heart", "Britney Spears", [3, 41],
                           1999)
        self.song_4 = Song(10004, "Club Tropicana", "Wham!", [4, 28], 1983)
        self.song_5 = Song(10005, "Virtual Insanity", "Jamiroquai", [4, 4],
                           1996)

        self.guest_1 = Guest("Lovefoxxx", 36, 50, self.song_1)
        self.guest_2 = Guest("Britney Spears", 38, 100, self.song_4)
        self.guest_3 = Guest("Damon Albarn", 52, 20, self.song_3)
        self.guest_4 = Guest("Jamiroquai", 50, 5, self.song_5)
        self.guest_5 = Guest("Human Child", 8, 20, self.song_2)
        self.guest_6 = Guest("Jay-Z", 50, 10000, self.song_5)
        self.guest_7 = Guest("Shania Twain", 55, 80, self.song_1)
    def setUp(self):

        drink_1 = Drink("Guinness", 3, 3)
        drink_2 = Drink("Whiskey Sour", 6, 5)
        drink_3 = Drink("Tsingtao", 4, 3)
        
        drinks_list = [drink_1, drink_2, drink_3]

        self.bar_1 = Bar(500, drinks_list)

        self.song_1 = Song(10001, "Let's Make Love and Listen to Death from Above", "CSS", [3,30], 2005)
        self.song_4 = Song(10004, "Club Tropicana", "Wham!", [4, 28], 1983)

        self.guest_1 = Guest("Lovefoxxx", 36, 50, self.song_1)
        self.guest_2 = Guest("Britney Spears", 38, 100, self.song_4)

        self.room_1 = Room("Plush Paradise", 3)
Exemple #4
0
    def setUp(self):
        self.tennents = Beer("Tennents", 2.50, 50, 2, "Lager")
        self.house_red = Wine("House Red", 10.00, 10, 8, "red", "Australia")
        self.house_white = Wine("House Red", 10.00, 10, 8, "white", "New Zealand")

        stock = [self.tennents, self.house_red, self.house_white]

        self.main_bar = Bar("Main Bar", 0, stock)
        self.venue_1 = Venue("Nakatomi Tower", self.main_bar)
    def setUp(self):
        self.song_1 = Song("Run-D.M.C.", "Christmas in Hollis")
        self.song_2 = Song("Skeletons", "Stevie Wonder")
        self.song_3 = Song("Beethoven", "Ode to Joy")
        self.song_4 = Song("Let It Snow! Let It Snow! Let It Snow!", "Vaughn Monroe")
        self.song_5 = Song("Jingle Bells", "Bruce Willis")
        self.song_6 = Song(
            "Brandenburg Concerto No. 3 In G Major, (Allegro Moderato)", "Bach"
        )
        self.song_7 = Song("Winter Wonderland", " Felix Bernard and Richard B. Smith")

        self.guest_1 = Guest("John McLean", 39, self.song_1, 100.00, "Yippee-ky-ay!!")
        self.guest_2 = Guest(
            "Al Powell",
            43,
            self.song_2,
            50.00,
            "Now means now goddammit!, I'm under automatic rifle fire at Nakatomi, I need backup assistance now! NOW, GODDAMMIT, NOW!",
        )
        self.guest_3 = Guest(
            "Hans Gruber", 47, self.song_3, 10000.00, "WHERE ARE MY DETONATORS!"
        )
        self.guest_4 = Guest(
            "Karl Vreski", 35, self.song_4, 0.00, "No one kills him but me!"
        )
        self.guest_5 = Guest(
            "Argyle", 30, self.song_5, 20.00, "This *is* Christmas music!"
        )
        self.guest_6 = Guest(
            "Mr Takagi",
            35,
            self.song_6,
            100000.00,
            "I guess you'll just have to kill me then!",
        )
        self.tennents = Beer("Tennents", 2.50, 50, 2, "Lager")
        self.house_red = Wine("House Red", 10.00, 10, 8, "red", "Australia")
        self.house_white = Wine("House White", 10.00, 10, 8, "white", "New Zealand")

        self.stella = Beer("Stella Artois", 5.00, 10, 2.5, "Lager")

        stock = [self.tennents, self.house_red, self.house_white]

        self.main_bar = Bar("Main Bar", 0, stock)
 def setUp(self):
     self.drink1 = Bar("Vodka", 4.00)
     self.drink2 = Bar("Beer", 3.00)
     self.drink3 = Bar("Rum", 4.00)
Exemple #7
0
 def setUp(self):
     self.guest = Guest("jack", 28, 50.00, "Dancing Queen")
     self.guest2 = Guest("andy", 35, 75.00, "In the end")
     self.drink1 = Bar("Vodka", 4.00)
     self.drink2 = Bar("Beer", 3.00)
     self.drink3 = Bar("Rum", 6.00)
class TestBar(unittest.TestCase):
    def setUp(self):
        self.song_1 = Song("Run-D.M.C.", "Christmas in Hollis")
        self.song_2 = Song("Skeletons", "Stevie Wonder")
        self.song_3 = Song("Beethoven", "Ode to Joy")
        self.song_4 = Song("Let It Snow! Let It Snow! Let It Snow!", "Vaughn Monroe")
        self.song_5 = Song("Jingle Bells", "Bruce Willis")
        self.song_6 = Song(
            "Brandenburg Concerto No. 3 In G Major, (Allegro Moderato)", "Bach"
        )
        self.song_7 = Song("Winter Wonderland", " Felix Bernard and Richard B. Smith")

        self.guest_1 = Guest("John McLean", 39, self.song_1, 100.00, "Yippee-ky-ay!!")
        self.guest_2 = Guest(
            "Al Powell",
            43,
            self.song_2,
            50.00,
            "Now means now goddammit!, I'm under automatic rifle fire at Nakatomi, I need backup assistance now! NOW, GODDAMMIT, NOW!",
        )
        self.guest_3 = Guest(
            "Hans Gruber", 47, self.song_3, 10000.00, "WHERE ARE MY DETONATORS!"
        )
        self.guest_4 = Guest(
            "Karl Vreski", 35, self.song_4, 0.00, "No one kills him but me!"
        )
        self.guest_5 = Guest(
            "Argyle", 30, self.song_5, 20.00, "This *is* Christmas music!"
        )
        self.guest_6 = Guest(
            "Mr Takagi",
            35,
            self.song_6,
            100000.00,
            "I guess you'll just have to kill me then!",
        )
        self.tennents = Beer("Tennents", 2.50, 50, 2, "Lager")
        self.house_red = Wine("House Red", 10.00, 10, 8, "red", "Australia")
        self.house_white = Wine("House White", 10.00, 10, 8, "white", "New Zealand")

        self.stella = Beer("Stella Artois", 5.00, 10, 2.5, "Lager")

        stock = [self.tennents, self.house_red, self.house_white]

        self.main_bar = Bar("Main Bar", 0, stock)

    def test_bar_name(self):
        self.assertEqual("Main Bar", self.main_bar.name)

    def test_bar_till(self):
        self.assertEqual(0, self.main_bar.till)

    def test_bar_stock_list(self):
        self.assertEqual(3, len(self.main_bar.stock_list))

    def test_add_money_to_till(self):
        self.main_bar.add_money_to_till(10)
        self.assertEqual(10, self.main_bar.till)

    def test_check_item_in_list__in_list(self):
        result = self.main_bar.check_item_in_stock_list(self.tennents)
        self.assertEqual(True, result)

    def test_check_item_in_list__not_in_list(self):
        result = self.main_bar.check_item_in_stock_list(self.stella)
        self.assertEqual(False, result)

    def test_check_item_quantity__exact_match(self):
        result = self.main_bar.check_item_quantity(self.tennents)
        self.assertEqual(True, result)

    def test_check_item_quantity__less_than_quantity(self):
        self.tennents = Beer("Tennents", 2.50, 49, 2, "Lager")
        result = self.main_bar.check_item_quantity(self.tennents)
        self.assertEqual(True, result)

    def test_check_item_quantity__more_than_quantity(self):
        self.tennents = Beer("Tennents", 2.50, 51, 2, "Lager")
        result = self.main_bar.check_item_quantity(self.tennents)
        self.assertEqual(False, result)

    def test_reduce_item_quantity(self):
        house_red_single = Wine("House Red", 10.00, 1, 8, "red", "Australia")
        self.main_bar.reduce_item_quantity(house_red_single)
        self.assertEqual(9, self.house_red.quantity)

    def test_sell_item_to_customer(self):
        tennents_single = Beer("Tennents", 2.50, 1, 2, "Lager")
        self.main_bar.sell_item_to_customer(self.guest_1, tennents_single)
        self.assertEqual(49, self.tennents.quantity)
        self.assertEqual(2.50, self.main_bar.till)
        self.assertEqual(97.50, self.guest_1.wallet)