def confirm( self ):
        r1= Route.get( '005-Outbound' )
        #print( r1 )
        self.assertEqual( datetime.date(2012,3,15), r1.date )
        self.assertEqual( '005', r1.route )
        self.assertEqual( 'Outbound', r1.direction )
        self.assertEqual( 1, len(r1.history))

        update_route_stop( self.arr )
        rs1 = RouteStop.get( '005-Outbound-0007')
        #print( rs1 )
        self.assertEqual( datetime.date(2012,3,15), rs1.date )
        self.assertEqual( '005', rs1.route )
        self.assertEqual( 'Outbound', rs1.direction )
        self.assertEqual( '0007', rs1.stop )
        self.assertEqual( 1, len(rs1.history))

        update_stop( self.arr )
        s1= Stop.get( '0007' )
        #print( s1 )
        self.assertEqual( datetime.date(2012,3,15), s1.date )
        self.assertEqual( '0007', s1.stop )
        self.assertEqual( 1, len(s1.history))

        update_vehicle( self.arr )
        v1= Vehicle.get( '5011' )
        #print( v1 )
        self.assertEqual( datetime.date(2012,3,15), v1.date )
        self.assertEqual( '5011', v1.vehicle )
 def tearDown( self ):
     global db
     for r in Route.view('status/route'):
         db.delete_doc(r)
     for rs in RouteStop.view('status/routestop'):
         db.delete_doc( rs )
     for s in Stop.view('status/stop'):
         db.delete_doc( s )
     for v in Vehicle.view('status/vehicle'):
         db.delete_doc( v )
    def setUp( self ):
        global db

        self.loc= Location(
            timestamp= datetime.datetime(2012,3,15,1,2,3),
            id= '1.1.1234',
            lat= 36.0,
            lon= -76.0,
        )
        self.arr= Arrival(
            timestamp= datetime.datetime(2012,3,15,1,2,3),
            id= '1.1.2345',
            lat= 36.1,
            lon= -76.2,
            time= 25678,
            rte= '1',
            dir= '2',
            stop= '3',
        )

        Route.set_db(db)
        RouteStop.set_db(db)
        Stop.set_db(db)
        Vehicle.set_db(db)