def testFillTripWithInvalidData(self):
    testMovesSec = {}
    testMovesSec['type'] = 'move'
    testMovesSec['place'] = {}
    testMovesSec['place']['id'] = 10
    testMovesSec['place']['type'] = 'home'
    testMovesSec['place']['location'] = {u'lat': 37, u'lon': -122, u'time': u'20140407T083200-0700'}

    newSec = {} 
    collect.fillTripWithMovesData(testMovesSec, newSec)

    self.assertEquals(newSec['type'], 'move')
    self.assertEquals(newSec['trip_start_time'], "")
    self.assertEquals(newSec['trip_end_time'], "")
    self.assertEquals(newSec['trip_start_datetime'], None)
    self.assertEquals(newSec['trip_end_datetime'], None)
    self.assertEquals(newSec['place']['place_location']['coordinates'][0], -122)
  def testFillTripWithValidData(self):
    testMovesSec = {}
    testMovesSec['type'] = 'move'
    testMovesSec['startTime'] = "20140407T183039-0700"
    testMovesSec['endTime'] = "20140407T191539-0700"
    testMovesSec['place'] = {}
    testMovesSec['place']['id'] = 10
    testMovesSec['place']['type'] = 'home'
    testMovesSec['place']['location'] = {u'lat': 37, u'lon': -122, u'time': u'20140407T083200-0700'}

    newSec = {} 
    collect.fillTripWithMovesData(testMovesSec, newSec)

    self.assertEquals(newSec['type'], 'move')
    self.assertEquals(newSec['trip_start_time'], "20140407T183039-0700")
    self.assertEquals(newSec['trip_end_time'], "20140407T191539-0700")
    self.assertEquals(newSec['trip_start_datetime'].month, 04)
    self.assertEquals(newSec['trip_end_datetime'].hour, 19)
    self.assertEquals(newSec['place']['place_location']['coordinates'][0], -122)
Пример #3
0
    def testFillTripWithInvalidData(self):
        testMovesSec = {}
        testMovesSec['type'] = 'move'
        testMovesSec['place'] = {}
        testMovesSec['place']['id'] = 10
        testMovesSec['place']['type'] = 'home'
        testMovesSec['place']['location'] = {
            u'lat': 37,
            u'lon': -122,
            u'time': u'20140407T083200-0700'
        }

        newSec = {}
        collect.fillTripWithMovesData(testMovesSec, newSec)

        self.assertEquals(newSec['type'], 'move')
        self.assertEquals(newSec['trip_start_time'], "")
        self.assertEquals(newSec['trip_end_time'], "")
        self.assertEquals(newSec['trip_start_datetime'], None)
        self.assertEquals(newSec['trip_end_datetime'], None)
        self.assertEquals(newSec['place']['place_location']['coordinates'][0],
                          -122)
Пример #4
0
    def testFillTripWithValidData(self):
        testMovesSec = {}
        testMovesSec['type'] = 'move'
        testMovesSec['startTime'] = "20140407T183039-0700"
        testMovesSec['endTime'] = "20140407T191539-0700"
        testMovesSec['place'] = {}
        testMovesSec['place']['id'] = 10
        testMovesSec['place']['type'] = 'home'
        testMovesSec['place']['location'] = {
            u'lat': 37,
            u'lon': -122,
            u'time': u'20140407T083200-0700'
        }

        newSec = {}
        collect.fillTripWithMovesData(testMovesSec, newSec)

        self.assertEquals(newSec['type'], 'move')
        self.assertEquals(newSec['trip_start_time'], "20140407T183039-0700")
        self.assertEquals(newSec['trip_end_time'], "20140407T191539-0700")
        self.assertEquals(newSec['trip_start_datetime'].month, 04)
        self.assertEquals(newSec['trip_end_datetime'].hour, 19)
        self.assertEquals(newSec['place']['place_location']['coordinates'][0],
                          -122)