コード例 #1
0
    def test_reservation_class(self):
        """Test core reservation class, expecting 2 reservations"""
        r = Reservations(2)
        self.assertFalse(r.done())

        # add first reservation
        r.add({'node': 1})
        self.assertFalse(r.done())
        self.assertEqual(r.remaining(), 1)

        # add second reservation
        r.add({'node': 2})
        self.assertTrue(r.done())
        self.assertEqual(r.remaining(), 0)

        # get final list
        reservations = r.get()
        self.assertEqual(len(reservations), 2)
コード例 #2
0
    def test_reservation_class(self):
        # expect 2 reservations
        r = Reservations(2)
        self.assertFalse(r.done())

        # add first reservation
        r.add({'node':1})
        self.assertFalse(r.done())
        self.assertEquals(r.remaining(), 1)

        # add second reservation
        r.add({'node':2})
        self.assertTrue(r.done())
        self.assertEquals(r.remaining(), 0)

        # get final list
        reservations = r.get()
        self.assertEquals(len(reservations), 2)