def test_getAccelerationCount(self, dbsession):
        db_url = 'postgresql://localhost/db1?ssl=true'
        device_info_serial = 1234
        start = datetime(2013, 1, 1, tzinfo=UTC)
        end = datetime(2013, 12, 12, tzinfo=UTC)
        query = Mock(Query)
        session = Mock(Session)
        session.query.return_value = query
        dbsession.return_value = session

        models.getAccelerationCount(db_url, device_info_serial, start, end)

        query.count.assert_called()
    def formfields2taskargs(self, fields, db_url):
        schema = Schema()
        taskargs = schema.deserialize(fields)

        # Test if selection will give results
        validateRange(getAccelerationCount(db_url,
                                           taskargs['tracker_id'],
                                           taskargs['start'],
                                           taskargs['end'],
                                           ), 0, self.MAX_ACC_COUNT)

        taskargs['db_url'] = db_url
        return taskargs