Initial checkin
This commit is contained in:
27
test/test_auto.py
Normal file
27
test/test_auto.py
Normal file
@@ -0,0 +1,27 @@
|
||||
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]
|
||||
Reference in New Issue
Block a user