def setup(self):
     self.apb = AppointmentBook()
     self.app = Appointment("World domination", "2014-04-01")
Esempio n. 2
0
 def setup(self):
     self.apb = AppointmentBook()
     self.app = Appointment("World domination", "2014-04-01")
class TestAppointmentBook():
    def setup(self):
        self.apb = AppointmentBook()
        self.app = Appointment("World domination", "2014-04-01")

    def test_get_number_of_appointments(self):
        eq_(0, self.apb.get_number_of_appointments())

    def test_list_appointments(self):
        eq_("", self.apb.list_appointments())

    def test_add_appointment(self):
        self.apb.add_appointment(self.app)
        eq_(1, self.apb.get_number_of_appointments())
        eq_("[1] 2014-04-01 - World domination", self.apb.list_appointments())

    @raises(IndexError)
    def test_remove_non_existing_appointment(self):
        self.apb.remove_appointment(5)

    def test_remove_existing_appointment(self):
        self.apb.add_appointment(self.app)
        eq_(1, self.apb.get_number_of_appointments())
        self.apb.remove_appointment(1)
        eq_(0, self.apb.get_number_of_appointments())
Esempio n. 4
0
class TestAppointmentBook:
    def setup(self):
        self.apb = AppointmentBook()
        self.app = Appointment("World domination", "2014-04-01")

    def test_get_number_of_appointments(self):
        eq_(0, self.apb.get_number_of_appointments())

    def test_list_appointments(self):
        eq_("", self.apb.list_appointments())

    def test_add_appointment(self):
        self.apb.add_appointment(self.app)
        eq_(1, self.apb.get_number_of_appointments())
        eq_("[1] 2014-04-01 - World domination", self.apb.list_appointments())

    @raises(IndexError)
    def test_remove_non_existing_appointment(self):
        self.apb.remove_appointment(5)

    def test_remove_existing_appointment(self):
        self.apb.add_appointment(self.app)
        eq_(1, self.apb.get_number_of_appointments())
        self.apb.remove_appointment(1)
        eq_(0, self.apb.get_number_of_appointments())