Add test to london underground (#100562)
Co-authored-by: Robert Resch <robert@resch.dev>
This commit is contained in:
parent
59daceafd2
commit
715d8dcb98
5 changed files with 555 additions and 0 deletions
|
@ -712,6 +712,7 @@ build.json @home-assistant/supervisor
|
|||
/homeassistant/components/logi_circle/ @evanjd
|
||||
/tests/components/logi_circle/ @evanjd
|
||||
/homeassistant/components/london_underground/ @jpbede
|
||||
/tests/components/london_underground/ @jpbede
|
||||
/homeassistant/components/lookin/ @ANMalko @bdraco
|
||||
/tests/components/lookin/ @ANMalko @bdraco
|
||||
/homeassistant/components/loqed/ @mikewoudenberg
|
||||
|
|
|
@ -897,6 +897,9 @@ life360==6.0.0
|
|||
# homeassistant.components.logi_circle
|
||||
logi-circle==0.2.3
|
||||
|
||||
# homeassistant.components.london_underground
|
||||
london-tube-status==0.5
|
||||
|
||||
# homeassistant.components.loqed
|
||||
loqedAPI==2.1.7
|
||||
|
||||
|
|
1
tests/components/london_underground/__init__.py
Normal file
1
tests/components/london_underground/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
"""Tests for the london_underground component."""
|
514
tests/components/london_underground/fixtures/line_status.json
Normal file
514
tests/components/london_underground/fixtures/line_status.json
Normal file
|
@ -0,0 +1,514 @@
|
|||
[
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.Line, Tfl.Api.Presentation.Entities",
|
||||
"id": "bakerloo",
|
||||
"name": "Bakerloo",
|
||||
"modeName": "tube",
|
||||
"disruptions": [],
|
||||
"created": "2023-09-11T10:28:16.97Z",
|
||||
"modified": "2023-09-11T10:28:16.97Z",
|
||||
"lineStatuses": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineStatus, Tfl.Api.Presentation.Entities",
|
||||
"id": 0,
|
||||
"statusSeverity": 10,
|
||||
"statusSeverityDescription": "Good Service",
|
||||
"created": "0001-01-01T00:00:00",
|
||||
"validityPeriods": []
|
||||
}
|
||||
],
|
||||
"routeSections": [],
|
||||
"serviceTypes": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineServiceTypeInfo, Tfl.Api.Presentation.Entities",
|
||||
"name": "Regular",
|
||||
"uri": "/Line/Route?ids=Bakerloo&serviceTypes=Regular"
|
||||
}
|
||||
],
|
||||
"crowding": {
|
||||
"$type": "Tfl.Api.Presentation.Entities.Crowding, Tfl.Api.Presentation.Entities"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.Line, Tfl.Api.Presentation.Entities",
|
||||
"id": "central",
|
||||
"name": "Central",
|
||||
"modeName": "tube",
|
||||
"disruptions": [],
|
||||
"created": "2023-09-11T10:28:16.987Z",
|
||||
"modified": "2023-09-11T10:28:16.987Z",
|
||||
"lineStatuses": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineStatus, Tfl.Api.Presentation.Entities",
|
||||
"id": 0,
|
||||
"statusSeverity": 10,
|
||||
"statusSeverityDescription": "Good Service",
|
||||
"created": "0001-01-01T00:00:00",
|
||||
"validityPeriods": []
|
||||
}
|
||||
],
|
||||
"routeSections": [],
|
||||
"serviceTypes": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineServiceTypeInfo, Tfl.Api.Presentation.Entities",
|
||||
"name": "Regular",
|
||||
"uri": "/Line/Route?ids=Central&serviceTypes=Regular"
|
||||
},
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineServiceTypeInfo, Tfl.Api.Presentation.Entities",
|
||||
"name": "Night",
|
||||
"uri": "/Line/Route?ids=Central&serviceTypes=Night"
|
||||
}
|
||||
],
|
||||
"crowding": {
|
||||
"$type": "Tfl.Api.Presentation.Entities.Crowding, Tfl.Api.Presentation.Entities"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.Line, Tfl.Api.Presentation.Entities",
|
||||
"id": "circle",
|
||||
"name": "Circle",
|
||||
"modeName": "tube",
|
||||
"disruptions": [],
|
||||
"created": "2023-09-11T10:28:16.97Z",
|
||||
"modified": "2023-09-11T10:28:16.97Z",
|
||||
"lineStatuses": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineStatus, Tfl.Api.Presentation.Entities",
|
||||
"id": 0,
|
||||
"statusSeverity": 10,
|
||||
"statusSeverityDescription": "Good Service",
|
||||
"created": "0001-01-01T00:00:00",
|
||||
"validityPeriods": []
|
||||
}
|
||||
],
|
||||
"routeSections": [],
|
||||
"serviceTypes": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineServiceTypeInfo, Tfl.Api.Presentation.Entities",
|
||||
"name": "Regular",
|
||||
"uri": "/Line/Route?ids=Circle&serviceTypes=Regular"
|
||||
}
|
||||
],
|
||||
"crowding": {
|
||||
"$type": "Tfl.Api.Presentation.Entities.Crowding, Tfl.Api.Presentation.Entities"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.Line, Tfl.Api.Presentation.Entities",
|
||||
"id": "district",
|
||||
"name": "District",
|
||||
"modeName": "tube",
|
||||
"disruptions": [],
|
||||
"created": "2023-09-11T10:28:16.97Z",
|
||||
"modified": "2023-09-11T10:28:16.97Z",
|
||||
"lineStatuses": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineStatus, Tfl.Api.Presentation.Entities",
|
||||
"id": 0,
|
||||
"lineId": "district",
|
||||
"statusSeverity": 3,
|
||||
"statusSeverityDescription": "Part Suspended",
|
||||
"reason": "District Line: No service between Turnham Green and Ealing Broadway while we remove a tree from the track at Ealing Common. Valid tickets will be accepted on local buses. GOOD SERVICE on the rest of the line ",
|
||||
"created": "0001-01-01T00:00:00",
|
||||
"validityPeriods": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.ValidityPeriod, Tfl.Api.Presentation.Entities",
|
||||
"fromDate": "2023-09-18T18:25:36Z",
|
||||
"toDate": "2023-09-18T22:06:14Z",
|
||||
"isNow": true
|
||||
}
|
||||
],
|
||||
"disruption": {
|
||||
"$type": "Tfl.Api.Presentation.Entities.Disruption, Tfl.Api.Presentation.Entities",
|
||||
"category": "RealTime",
|
||||
"categoryDescription": "RealTime",
|
||||
"description": "District Line: No service between Turnham Green and Ealing Broadway while we remove a tree from the track at Ealing Common. Valid tickets will be accepted on local buses. GOOD SERVICE on the rest of the line ",
|
||||
"affectedRoutes": [],
|
||||
"affectedStops": [],
|
||||
"closureText": "partSuspended"
|
||||
}
|
||||
}
|
||||
],
|
||||
"routeSections": [],
|
||||
"serviceTypes": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineServiceTypeInfo, Tfl.Api.Presentation.Entities",
|
||||
"name": "Regular",
|
||||
"uri": "/Line/Route?ids=District&serviceTypes=Regular"
|
||||
}
|
||||
],
|
||||
"crowding": {
|
||||
"$type": "Tfl.Api.Presentation.Entities.Crowding, Tfl.Api.Presentation.Entities"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.Line, Tfl.Api.Presentation.Entities",
|
||||
"id": "dlr",
|
||||
"name": "DLR",
|
||||
"modeName": "dlr",
|
||||
"disruptions": [],
|
||||
"created": "2023-09-11T10:28:16.987Z",
|
||||
"modified": "2023-09-11T10:28:16.987Z",
|
||||
"lineStatuses": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineStatus, Tfl.Api.Presentation.Entities",
|
||||
"id": 0,
|
||||
"statusSeverity": 10,
|
||||
"statusSeverityDescription": "Good Service",
|
||||
"created": "0001-01-01T00:00:00",
|
||||
"validityPeriods": []
|
||||
}
|
||||
],
|
||||
"routeSections": [],
|
||||
"serviceTypes": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineServiceTypeInfo, Tfl.Api.Presentation.Entities",
|
||||
"name": "Regular",
|
||||
"uri": "/Line/Route?ids=DLR&serviceTypes=Regular"
|
||||
}
|
||||
],
|
||||
"crowding": {
|
||||
"$type": "Tfl.Api.Presentation.Entities.Crowding, Tfl.Api.Presentation.Entities"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.Line, Tfl.Api.Presentation.Entities",
|
||||
"id": "elizabeth",
|
||||
"name": "Elizabeth line",
|
||||
"modeName": "elizabeth-line",
|
||||
"disruptions": [],
|
||||
"created": "2023-09-11T10:28:16.97Z",
|
||||
"modified": "2023-09-11T10:28:16.97Z",
|
||||
"lineStatuses": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineStatus, Tfl.Api.Presentation.Entities",
|
||||
"id": 0,
|
||||
"statusSeverity": 10,
|
||||
"statusSeverityDescription": "Good Service",
|
||||
"created": "0001-01-01T00:00:00",
|
||||
"validityPeriods": []
|
||||
}
|
||||
],
|
||||
"routeSections": [],
|
||||
"serviceTypes": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineServiceTypeInfo, Tfl.Api.Presentation.Entities",
|
||||
"name": "Regular",
|
||||
"uri": "/Line/Route?ids=Elizabeth line&serviceTypes=Regular"
|
||||
}
|
||||
],
|
||||
"crowding": {
|
||||
"$type": "Tfl.Api.Presentation.Entities.Crowding, Tfl.Api.Presentation.Entities"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.Line, Tfl.Api.Presentation.Entities",
|
||||
"id": "hammersmith-city",
|
||||
"name": "Hammersmith & City",
|
||||
"modeName": "tube",
|
||||
"disruptions": [],
|
||||
"created": "2023-09-11T10:28:16.97Z",
|
||||
"modified": "2023-09-11T10:28:16.97Z",
|
||||
"lineStatuses": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineStatus, Tfl.Api.Presentation.Entities",
|
||||
"id": 0,
|
||||
"statusSeverity": 10,
|
||||
"statusSeverityDescription": "Good Service",
|
||||
"created": "0001-01-01T00:00:00",
|
||||
"validityPeriods": []
|
||||
}
|
||||
],
|
||||
"routeSections": [],
|
||||
"serviceTypes": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineServiceTypeInfo, Tfl.Api.Presentation.Entities",
|
||||
"name": "Regular",
|
||||
"uri": "/Line/Route?ids=Hammersmith & City&serviceTypes=Regular"
|
||||
}
|
||||
],
|
||||
"crowding": {
|
||||
"$type": "Tfl.Api.Presentation.Entities.Crowding, Tfl.Api.Presentation.Entities"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.Line, Tfl.Api.Presentation.Entities",
|
||||
"id": "jubilee",
|
||||
"name": "Jubilee",
|
||||
"modeName": "tube",
|
||||
"disruptions": [],
|
||||
"created": "2023-09-11T10:28:16.97Z",
|
||||
"modified": "2023-09-11T10:28:16.97Z",
|
||||
"lineStatuses": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineStatus, Tfl.Api.Presentation.Entities",
|
||||
"id": 0,
|
||||
"statusSeverity": 10,
|
||||
"statusSeverityDescription": "Good Service",
|
||||
"created": "0001-01-01T00:00:00",
|
||||
"validityPeriods": []
|
||||
}
|
||||
],
|
||||
"routeSections": [],
|
||||
"serviceTypes": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineServiceTypeInfo, Tfl.Api.Presentation.Entities",
|
||||
"name": "Regular",
|
||||
"uri": "/Line/Route?ids=Jubilee&serviceTypes=Regular"
|
||||
},
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineServiceTypeInfo, Tfl.Api.Presentation.Entities",
|
||||
"name": "Night",
|
||||
"uri": "/Line/Route?ids=Jubilee&serviceTypes=Night"
|
||||
}
|
||||
],
|
||||
"crowding": {
|
||||
"$type": "Tfl.Api.Presentation.Entities.Crowding, Tfl.Api.Presentation.Entities"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.Line, Tfl.Api.Presentation.Entities",
|
||||
"id": "london-overground",
|
||||
"name": "London Overground",
|
||||
"modeName": "overground",
|
||||
"disruptions": [],
|
||||
"created": "2023-09-11T10:28:16.97Z",
|
||||
"modified": "2023-09-11T10:28:16.97Z",
|
||||
"lineStatuses": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineStatus, Tfl.Api.Presentation.Entities",
|
||||
"id": 0,
|
||||
"statusSeverity": 10,
|
||||
"statusSeverityDescription": "Good Service",
|
||||
"created": "0001-01-01T00:00:00",
|
||||
"validityPeriods": []
|
||||
}
|
||||
],
|
||||
"routeSections": [],
|
||||
"serviceTypes": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineServiceTypeInfo, Tfl.Api.Presentation.Entities",
|
||||
"name": "Regular",
|
||||
"uri": "/Line/Route?ids=London Overground&serviceTypes=Regular"
|
||||
},
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineServiceTypeInfo, Tfl.Api.Presentation.Entities",
|
||||
"name": "Night",
|
||||
"uri": "/Line/Route?ids=London Overground&serviceTypes=Night"
|
||||
}
|
||||
],
|
||||
"crowding": {
|
||||
"$type": "Tfl.Api.Presentation.Entities.Crowding, Tfl.Api.Presentation.Entities"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.Line, Tfl.Api.Presentation.Entities",
|
||||
"id": "metropolitan",
|
||||
"name": "Metropolitan",
|
||||
"modeName": "tube",
|
||||
"disruptions": [],
|
||||
"created": "2023-09-11T10:28:16.97Z",
|
||||
"modified": "2023-09-11T10:28:16.97Z",
|
||||
"lineStatuses": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineStatus, Tfl.Api.Presentation.Entities",
|
||||
"id": 0,
|
||||
"statusSeverity": 10,
|
||||
"statusSeverityDescription": "Good Service",
|
||||
"created": "0001-01-01T00:00:00",
|
||||
"validityPeriods": []
|
||||
}
|
||||
],
|
||||
"routeSections": [],
|
||||
"serviceTypes": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineServiceTypeInfo, Tfl.Api.Presentation.Entities",
|
||||
"name": "Regular",
|
||||
"uri": "/Line/Route?ids=Metropolitan&serviceTypes=Regular"
|
||||
}
|
||||
],
|
||||
"crowding": {
|
||||
"$type": "Tfl.Api.Presentation.Entities.Crowding, Tfl.Api.Presentation.Entities"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.Line, Tfl.Api.Presentation.Entities",
|
||||
"id": "northern",
|
||||
"name": "Northern",
|
||||
"modeName": "tube",
|
||||
"disruptions": [],
|
||||
"created": "2023-09-11T10:28:16.97Z",
|
||||
"modified": "2023-09-11T10:28:16.97Z",
|
||||
"lineStatuses": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineStatus, Tfl.Api.Presentation.Entities",
|
||||
"id": 0,
|
||||
"statusSeverity": 10,
|
||||
"statusSeverityDescription": "Good Service",
|
||||
"created": "0001-01-01T00:00:00",
|
||||
"validityPeriods": []
|
||||
}
|
||||
],
|
||||
"routeSections": [],
|
||||
"serviceTypes": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineServiceTypeInfo, Tfl.Api.Presentation.Entities",
|
||||
"name": "Regular",
|
||||
"uri": "/Line/Route?ids=Northern&serviceTypes=Regular"
|
||||
},
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineServiceTypeInfo, Tfl.Api.Presentation.Entities",
|
||||
"name": "Night",
|
||||
"uri": "/Line/Route?ids=Northern&serviceTypes=Night"
|
||||
}
|
||||
],
|
||||
"crowding": {
|
||||
"$type": "Tfl.Api.Presentation.Entities.Crowding, Tfl.Api.Presentation.Entities"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.Line, Tfl.Api.Presentation.Entities",
|
||||
"id": "piccadilly",
|
||||
"name": "Piccadilly",
|
||||
"modeName": "tube",
|
||||
"disruptions": [],
|
||||
"created": "2023-09-11T10:28:16.97Z",
|
||||
"modified": "2023-09-11T10:28:16.97Z",
|
||||
"lineStatuses": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineStatus, Tfl.Api.Presentation.Entities",
|
||||
"id": 0,
|
||||
"lineId": "piccadilly",
|
||||
"statusSeverity": 6,
|
||||
"statusSeverityDescription": "Severe Delays",
|
||||
"reason": "Piccadilly Line: No service between Acton Town and Uxbridge while we remove a tree from the track at Ealing Common. Severe delays between Acton Town and Cockfosters, eastbound only. GOOD SERVICE on the rest of the line. Valid tickets will be accepted on local buses, London Overground, Great Northern and South Western Railway. ",
|
||||
"created": "0001-01-01T00:00:00",
|
||||
"validityPeriods": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.ValidityPeriod, Tfl.Api.Presentation.Entities",
|
||||
"fromDate": "2023-09-18T19:01:20Z",
|
||||
"toDate": "2023-09-19T00:29:00Z",
|
||||
"isNow": true
|
||||
}
|
||||
],
|
||||
"disruption": {
|
||||
"$type": "Tfl.Api.Presentation.Entities.Disruption, Tfl.Api.Presentation.Entities",
|
||||
"category": "RealTime",
|
||||
"categoryDescription": "RealTime",
|
||||
"description": "Piccadilly Line: No service between Acton Town and Uxbridge while we remove a tree from the track at Ealing Common. Severe delays between Acton Town and Cockfosters, eastbound only. GOOD SERVICE on the rest of the line. Valid tickets will be accepted on local buses, London Overground, Great Northern and South Western Railway. ",
|
||||
"affectedRoutes": [],
|
||||
"affectedStops": [],
|
||||
"closureText": "severeDelays"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineStatus, Tfl.Api.Presentation.Entities",
|
||||
"id": 0,
|
||||
"lineId": "piccadilly",
|
||||
"statusSeverity": 3,
|
||||
"statusSeverityDescription": "Part Suspended",
|
||||
"reason": "Piccadilly Line: No service between Acton Town and Uxbridge while we remove a tree from the track at Ealing Common. Severe delays between Acton Town and Cockfosters, eastbound only. GOOD SERVICE on the rest of the line. Valid tickets will be accepted on local buses, London Overground, Great Northern and South Western Railway. ",
|
||||
"created": "0001-01-01T00:00:00",
|
||||
"validityPeriods": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.ValidityPeriod, Tfl.Api.Presentation.Entities",
|
||||
"fromDate": "2023-09-18T19:01:20Z",
|
||||
"toDate": "2023-09-18T22:06:14Z",
|
||||
"isNow": true
|
||||
}
|
||||
],
|
||||
"disruption": {
|
||||
"$type": "Tfl.Api.Presentation.Entities.Disruption, Tfl.Api.Presentation.Entities",
|
||||
"category": "RealTime",
|
||||
"categoryDescription": "RealTime",
|
||||
"description": "Piccadilly Line: No service between Acton Town and Uxbridge while we remove a tree from the track at Ealing Common. Severe delays between Acton Town and Cockfosters, eastbound only. GOOD SERVICE on the rest of the line. Valid tickets will be accepted on local buses, London Overground, Great Northern and South Western Railway. ",
|
||||
"affectedRoutes": [],
|
||||
"affectedStops": [],
|
||||
"closureText": "partSuspended"
|
||||
}
|
||||
}
|
||||
],
|
||||
"routeSections": [],
|
||||
"serviceTypes": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineServiceTypeInfo, Tfl.Api.Presentation.Entities",
|
||||
"name": "Regular",
|
||||
"uri": "/Line/Route?ids=Piccadilly&serviceTypes=Regular"
|
||||
},
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineServiceTypeInfo, Tfl.Api.Presentation.Entities",
|
||||
"name": "Night",
|
||||
"uri": "/Line/Route?ids=Piccadilly&serviceTypes=Night"
|
||||
}
|
||||
],
|
||||
"crowding": {
|
||||
"$type": "Tfl.Api.Presentation.Entities.Crowding, Tfl.Api.Presentation.Entities"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.Line, Tfl.Api.Presentation.Entities",
|
||||
"id": "victoria",
|
||||
"name": "Victoria",
|
||||
"modeName": "tube",
|
||||
"disruptions": [],
|
||||
"created": "2023-09-11T10:28:16.97Z",
|
||||
"modified": "2023-09-11T10:28:16.97Z",
|
||||
"lineStatuses": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineStatus, Tfl.Api.Presentation.Entities",
|
||||
"id": 0,
|
||||
"statusSeverity": 10,
|
||||
"statusSeverityDescription": "Good Service",
|
||||
"created": "0001-01-01T00:00:00",
|
||||
"validityPeriods": []
|
||||
}
|
||||
],
|
||||
"routeSections": [],
|
||||
"serviceTypes": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineServiceTypeInfo, Tfl.Api.Presentation.Entities",
|
||||
"name": "Regular",
|
||||
"uri": "/Line/Route?ids=Victoria&serviceTypes=Regular"
|
||||
},
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineServiceTypeInfo, Tfl.Api.Presentation.Entities",
|
||||
"name": "Night",
|
||||
"uri": "/Line/Route?ids=Victoria&serviceTypes=Night"
|
||||
}
|
||||
],
|
||||
"crowding": {
|
||||
"$type": "Tfl.Api.Presentation.Entities.Crowding, Tfl.Api.Presentation.Entities"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.Line, Tfl.Api.Presentation.Entities",
|
||||
"id": "waterloo-city",
|
||||
"name": "Waterloo & City",
|
||||
"modeName": "tube",
|
||||
"disruptions": [],
|
||||
"created": "2023-09-11T10:28:16.987Z",
|
||||
"modified": "2023-09-11T10:28:16.987Z",
|
||||
"lineStatuses": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineStatus, Tfl.Api.Presentation.Entities",
|
||||
"id": 0,
|
||||
"statusSeverity": 10,
|
||||
"statusSeverityDescription": "Good Service",
|
||||
"created": "0001-01-01T00:00:00",
|
||||
"validityPeriods": []
|
||||
}
|
||||
],
|
||||
"routeSections": [],
|
||||
"serviceTypes": [
|
||||
{
|
||||
"$type": "Tfl.Api.Presentation.Entities.LineServiceTypeInfo, Tfl.Api.Presentation.Entities",
|
||||
"name": "Regular",
|
||||
"uri": "/Line/Route?ids=Waterloo & City&serviceTypes=Regular"
|
||||
}
|
||||
],
|
||||
"crowding": {
|
||||
"$type": "Tfl.Api.Presentation.Entities.Crowding, Tfl.Api.Presentation.Entities"
|
||||
}
|
||||
}
|
||||
]
|
36
tests/components/london_underground/test_sensor.py
Normal file
36
tests/components/london_underground/test_sensor.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
"""The tests for the london_underground platform."""
|
||||
from london_tube_status import API_URL
|
||||
|
||||
from homeassistant.components.london_underground.const import CONF_LINE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import load_fixture
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
||||
VALID_CONFIG = {
|
||||
"sensor": {"platform": "london_underground", CONF_LINE: ["Metropolitan"]}
|
||||
}
|
||||
|
||||
|
||||
async def test_valid_state(
|
||||
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
|
||||
) -> None:
|
||||
"""Test for operational london_underground sensor with proper attributes."""
|
||||
aioclient_mock.get(
|
||||
API_URL,
|
||||
text=load_fixture("line_status.json", "london_underground"),
|
||||
)
|
||||
|
||||
assert await async_setup_component(hass, "sensor", VALID_CONFIG)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get("sensor.metropolitan")
|
||||
assert state
|
||||
assert state.state == "Good Service"
|
||||
assert state.attributes == {
|
||||
"Description": "Nothing to report",
|
||||
"attribution": "Powered by TfL Open Data",
|
||||
"friendly_name": "Metropolitan",
|
||||
"icon": "mdi:subway",
|
||||
}
|
Loading…
Add table
Reference in a new issue