def test_pay_fines(self):
        member1 = membermgr.create('*****@*****.**')
        member2 = membermgr.create('*****@*****.**')
        member3 = membermgr.create('*****@*****.**')

        member1.fines = 10
        member2.fines = 5
        member3.fines = 12

        pay_fines.main()

        self.assertEqual(member1.fines, 0)
        self.assertEqual(member2.fines, 0)
        self.assertEqual(member3.fines, 0)
Beispiel #2
0
    def setUp(self):
        super(MemberTest, self).setUp()

        self.member = membermgr.create(emailaddress='*****@*****.**')
        for i in range(15):
            itemmgr.create('Book', title='Book_%d' % i, author='Author_%d' % i)

        self.books = blazers.db.find('Book')
Beispiel #3
0
    def test_checkout(self):
        self.member.checkout(self.books[0])
        self.assertEqual(self.member.items, [self.books[0]])
        with self.assertRaises(Exception):
            self.member.checkout(self.books[0])
        self.member.checkout(self.books[1])
        self.assertEqual(self.member.items, [self.books[0], self.books[1]])

        other_member = membermgr.create('*****@*****.**')
        with self.assertRaises(Exception):
            other_member.checkout(self.books[0])
            other_member.checkout(self.books[1])
Beispiel #4
0
    def test_member(self):
        self.assertEqual(self.member.emailaddress, '*****@*****.**')
        self.assertEqual(blazers.db.find('Member'), [self.member])

        with self.assertRaises(Exception):
            membermgr.create(emailaddress='*****@*****.**')