Change name to title when returning lots

This commit is contained in:
Xavier Bustamante Talavera 2018-10-08 12:25:28 +02:00
parent a76560d253
commit a3f6d7877a
3 changed files with 4 additions and 4 deletions

View file

@ -31,7 +31,6 @@ class Event(Thing):
error = ... # type: Column error = ... # type: Column
incidence = ... # type: Column incidence = ... # type: Column
description = ... # type: Column description = ... # type: Column
finalized = ... # type: Column
snapshot_id = ... # type: Column snapshot_id = ... # type: Column
snapshot = ... # type: relationship snapshot = ... # type: relationship
author_id = ... # type: Column author_id = ... # type: Column
@ -79,6 +78,7 @@ class EventWithOneDevice(Event):
class EventWithMultipleDevices(Event): class EventWithMultipleDevices(Event):
devices = ... # type: relationship
def __init__(self, id=None, name=None, incidence=None, closed=None, error=None, def __init__(self, id=None, name=None, incidence=None, closed=None, error=None,
description=None, start_time=None, end_time=None, snapshot=None, agent=None, description=None, start_time=None, end_time=None, snapshot=None, agent=None,

View file

@ -58,7 +58,7 @@ class LotView(View):
lot = Lot.query.filter_by(id=lot_id).one() lot = Lot.query.filter_by(id=lot_id).one()
node = { node = {
'id': lot_id, 'id': lot_id,
'title': lot.name, 'name': lot.name,
'url': lot.url.to_text(), 'url': lot.url.to_text(),
'closed': lot.closed, 'closed': lot.closed,
'updated': lot.updated, 'updated': lot.updated,

View file

@ -223,9 +223,9 @@ def test_post_add_children_view(user: UserClient):
lots = user.get(res=Lot)[0]['items'] lots = user.get(res=Lot)[0]['items']
assert len(lots) == 1 assert len(lots) == 1
assert lots[0]['title'] == 'Parent' assert lots[0]['name'] == 'Parent'
assert len(lots[0]['nodes']) == 1 assert len(lots[0]['nodes']) == 1
assert lots[0]['nodes'][0]['title'] == 'Child' assert lots[0]['nodes'][0]['name'] == 'Child'
def test_lot_post_add_remove_device_view(app: Devicehub, user: UserClient): def test_lot_post_add_remove_device_view(app: Devicehub, user: UserClient):