Example #1
0
class TestPentagoDB(unittest.TestCase):
    def setUp(self):
        self.database = PentagoDatabase('sqlite:///:memory:')
    
    def tearDown(self):
        for table in self.database.tables:
            table.drop()
        clear_mappers()
    
    def test_eq(self):
        p = Player('hitchhiker', '42', 'Douglas Adams',
                   '*****@*****.**')
        p2 = Player('hitchhiker', '42', 'Douglas Adams',
                   '*****@*****.**')
        p3 = Player('hitchhiker', '42', 'Arthur Dent',
                   '*****@*****.**')
        self.assertEqual(p, p2)
        self.assertNotEqual(p, p3)
    
    def test_insert(self):
        p = Player('hitchhiker', '42', 'Douglas Adams',
                   '*****@*****.**')
        with self.database.transaction as session:
            session.save(p)
        self.assertEquals(p, self.database.player_by_login('hitchhiker'))
Example #2
0
 def setUp(self):
     self.database = PentagoDatabase('sqlite:///:memory:')