27 lines
796 B
Python
27 lines
796 B
Python
from flask import json
|
|
from app.extensions import db
|
|
from app.models.shift import Shift
|
|
from app.models.battery_change import BatteryChange
|
|
from test import client
|
|
from test.utils import create_vehicles
|
|
|
|
def test_auto_shift_generation(client):
|
|
create_vehicles(8)
|
|
|
|
rv = client.get('/auto/40.68136179/-73.996421')
|
|
data = json.loads(rv.data)
|
|
|
|
print(data)
|
|
|
|
ids = [change['vehicle']['id'] for change in data['battery_changes']]
|
|
assert ids == [2, 1, 8, 6, 7, 5, 4, 3]
|
|
|
|
def test_auto_shift_generation_all(client):
|
|
create_vehicles()
|
|
|
|
rv = client.get('/auto/40.68136179/-73.996421')
|
|
data = json.loads(rv.data)
|
|
|
|
ids = [change['vehicle']['id'] for change in data['battery_changes']]
|
|
print(ids)
|
|
assert ids == [2, 1, 8, 6, 7, 5, 15, 4, 10, 11, 12, 9, 14, 13, 3] |