def test_should_see_bad_attachment( self ): global db feeds1 = list( Feed.view("feed/new") ) self.assertEqual( 1, len(feeds1) ) feeds2 = list( new_feed_iter() ) self.assertEqual( 1, len(feeds2) ) f, rdr= validate_and_open( feeds2[0] ) self.assertIsNone( rdr ) self.assertEquals( "wrong format attachment", f.status )
def test_should_open_and_read_feed( self ): global db feeds2 = list( new_feed_iter() ) self.assertEqual( 1, len(feeds2) ) f, rdr= validate_and_open( feeds2[0] ) self.assertEqual( self.feed_headings, rdr.source.fieldnames ) data = list( rdr ) self.assertEqual( 1, len(data) ) #print( data[0] ) self.assertEqual( datetime.datetime(2012,3,15,2,3,4), data[0].timestamp ) self.assertEqual( '123', data[0].id ) self.assertAlmostEqual( 36.12345, data[0].lat ) self.assertAlmostEqual( -76.23456, data[0].lon ) self.assertEqual( "V", data[0].ll_valid ) self.assertEqual( -1, data[0].adher ) self.assertEqual( "V", data[0].adher_valid ) self.assertEqual( "2", data[0].rte ) self.assertEqual( "3", data[0].dir ) self.assertEqual( "5", data[0].stop )