def test_specific_valid_position_logs_one_success(self,
                                                   machine: VendingMachine,
                                                   caplog):
     """
     Ensures that only one message gets logged
     """
     machine.view_items(1, 1)
     self.logs_one_message(caplog)
    def test_view_all_items(self, machine: VendingMachine, caplog):
        """
        Test ensures that the number of items returned to the user
        is len(items) - 1 (one initial success message)
        """

        machine.view_items()
        assert len(caplog.records) == len(machine.items)
    def test_invalid_position_logs_error(self, machine: VendingMachine,
                                         caplog):
        """
        Makes sure that if the user types in an invalid position, an error
        message shows
        """

        machine.view_items(column=22, row=100)
        self.logs_one_message(caplog)
        assert "ERROR" in caplog.text
        assert "isn't a slot" in caplog.text