mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 22:07:10 +00:00
Use snapshots for ConfigEntry migration tests (#136093)
* Add snapshots for migration * Reduce fixtures specific to migration * Explicitly test versions of migrated entries
This commit is contained in:
parent
bdc847c7ac
commit
d9726ab08c
@ -13,13 +13,6 @@
|
|||||||
"hardware_serial": -1,
|
"hardware_serial": -1,
|
||||||
"software_serial": -1,
|
"software_serial": -1,
|
||||||
"hardware_type": -1
|
"hardware_type": -1
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 5, true],
|
|
||||||
"name": "TestGroup",
|
|
||||||
"hardware_serial": -1,
|
|
||||||
"software_serial": -1,
|
|
||||||
"hardware_type": -1
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"entities": [
|
"entities": [
|
||||||
@ -33,216 +26,6 @@
|
|||||||
"dimmable": true,
|
"dimmable": true,
|
||||||
"transition": 5000.0
|
"transition": 5000.0
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Light_Output2",
|
|
||||||
"resource": "output2",
|
|
||||||
"domain": "light",
|
|
||||||
"domain_data": {
|
|
||||||
"output": "OUTPUT2",
|
|
||||||
"dimmable": false,
|
|
||||||
"transition": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Light_Relay1",
|
|
||||||
"resource": "relay1",
|
|
||||||
"domain": "light",
|
|
||||||
"domain_data": {
|
|
||||||
"output": "RELAY1",
|
|
||||||
"dimmable": false,
|
|
||||||
"transition": 0.0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Switch_Output1",
|
|
||||||
"resource": "output1",
|
|
||||||
"domain": "switch",
|
|
||||||
"domain_data": {
|
|
||||||
"output": "OUTPUT1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Switch_Output2",
|
|
||||||
"resource": "output2",
|
|
||||||
"domain": "switch",
|
|
||||||
"domain_data": {
|
|
||||||
"output": "OUTPUT2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Switch_Relay1",
|
|
||||||
"resource": "relay1",
|
|
||||||
"domain": "switch",
|
|
||||||
"domain_data": {
|
|
||||||
"output": "RELAY1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Switch_Relay2",
|
|
||||||
"resource": "relay2",
|
|
||||||
"domain": "switch",
|
|
||||||
"domain_data": {
|
|
||||||
"output": "RELAY2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Switch_Regulator1",
|
|
||||||
"resource": "r1varsetpoint",
|
|
||||||
"domain": "switch",
|
|
||||||
"domain_data": {
|
|
||||||
"output": "R1VARSETPOINT"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Switch_KeyLock1",
|
|
||||||
"resource": "a1",
|
|
||||||
"domain": "switch",
|
|
||||||
"domain_data": {
|
|
||||||
"output": "A1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 5, true],
|
|
||||||
"name": "Switch_Group5",
|
|
||||||
"resource": "relay1",
|
|
||||||
"domain": "switch",
|
|
||||||
"domain_data": {
|
|
||||||
"output": "RELAY1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Cover_Outputs",
|
|
||||||
"resource": "outputs",
|
|
||||||
"domain": "cover",
|
|
||||||
"domain_data": {
|
|
||||||
"motor": "OUTPUTS",
|
|
||||||
"reverse_time": "RT1200"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Cover_Relays",
|
|
||||||
"resource": "motor1",
|
|
||||||
"domain": "cover",
|
|
||||||
"domain_data": {
|
|
||||||
"motor": "MOTOR1",
|
|
||||||
"reverse_time": "RT1200"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Climate1",
|
|
||||||
"resource": "var1.r1varsetpoint",
|
|
||||||
"domain": "climate",
|
|
||||||
"domain_data": {
|
|
||||||
"source": "VAR1",
|
|
||||||
"setpoint": "R1VARSETPOINT",
|
|
||||||
"lockable": true,
|
|
||||||
"min_temp": 0.0,
|
|
||||||
"max_temp": 40.0,
|
|
||||||
"unit_of_measurement": "°C"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Romantic",
|
|
||||||
"resource": "0.0",
|
|
||||||
"domain": "scene",
|
|
||||||
"domain_data": {
|
|
||||||
"register": 0,
|
|
||||||
"scene": 0,
|
|
||||||
"outputs": ["OUTPUT1", "OUTPUT2", "RELAY1"],
|
|
||||||
"transition": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Romantic Transition",
|
|
||||||
"resource": "0.1",
|
|
||||||
"domain": "scene",
|
|
||||||
"domain_data": {
|
|
||||||
"register": 0,
|
|
||||||
"scene": 1,
|
|
||||||
"outputs": ["OUTPUT1", "OUTPUT2", "RELAY1"],
|
|
||||||
"transition": 10000
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Sensor_LockRegulator1",
|
|
||||||
"resource": "r1varsetpoint",
|
|
||||||
"domain": "binary_sensor",
|
|
||||||
"domain_data": {
|
|
||||||
"source": "R1VARSETPOINT"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Binary_Sensor1",
|
|
||||||
"resource": "binsensor1",
|
|
||||||
"domain": "binary_sensor",
|
|
||||||
"domain_data": {
|
|
||||||
"source": "BINSENSOR1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Sensor_KeyLock",
|
|
||||||
"resource": "a5",
|
|
||||||
"domain": "binary_sensor",
|
|
||||||
"domain_data": {
|
|
||||||
"source": "A5"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Sensor_Var1",
|
|
||||||
"resource": "var1",
|
|
||||||
"domain": "sensor",
|
|
||||||
"domain_data": {
|
|
||||||
"source": "VAR1",
|
|
||||||
"unit_of_measurement": "°C"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Sensor_Setpoint1",
|
|
||||||
"resource": "r1varsetpoint",
|
|
||||||
"domain": "sensor",
|
|
||||||
"domain_data": {
|
|
||||||
"source": "R1VARSETPOINT",
|
|
||||||
"unit_of_measurement": "°C"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Sensor_Led6",
|
|
||||||
"resource": "led6",
|
|
||||||
"domain": "sensor",
|
|
||||||
"domain_data": {
|
|
||||||
"source": "LED6",
|
|
||||||
"unit_of_measurement": "NATIVE"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Sensor_LogicOp1",
|
|
||||||
"resource": "logicop1",
|
|
||||||
"domain": "sensor",
|
|
||||||
"domain_data": {
|
|
||||||
"source": "LOGICOP1",
|
|
||||||
"unit_of_measurement": "NATIVE"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -14,13 +14,6 @@
|
|||||||
"hardware_serial": -1,
|
"hardware_serial": -1,
|
||||||
"software_serial": -1,
|
"software_serial": -1,
|
||||||
"hardware_type": -1
|
"hardware_type": -1
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 5, true],
|
|
||||||
"name": "TestGroup",
|
|
||||||
"hardware_serial": -1,
|
|
||||||
"software_serial": -1,
|
|
||||||
"hardware_type": -1
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"entities": [
|
"entities": [
|
||||||
@ -43,115 +36,7 @@
|
|||||||
"domain_data": {
|
"domain_data": {
|
||||||
"output": "OUTPUT2",
|
"output": "OUTPUT2",
|
||||||
"dimmable": false,
|
"dimmable": false,
|
||||||
"transition": 0
|
"transition": null
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Light_Relay1",
|
|
||||||
"resource": "relay1",
|
|
||||||
"domain": "light",
|
|
||||||
"domain_data": {
|
|
||||||
"output": "RELAY1",
|
|
||||||
"dimmable": false,
|
|
||||||
"transition": 0.0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Switch_Output1",
|
|
||||||
"resource": "output1",
|
|
||||||
"domain": "switch",
|
|
||||||
"domain_data": {
|
|
||||||
"output": "OUTPUT1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Switch_Output2",
|
|
||||||
"resource": "output2",
|
|
||||||
"domain": "switch",
|
|
||||||
"domain_data": {
|
|
||||||
"output": "OUTPUT2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Switch_Relay1",
|
|
||||||
"resource": "relay1",
|
|
||||||
"domain": "switch",
|
|
||||||
"domain_data": {
|
|
||||||
"output": "RELAY1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Switch_Relay2",
|
|
||||||
"resource": "relay2",
|
|
||||||
"domain": "switch",
|
|
||||||
"domain_data": {
|
|
||||||
"output": "RELAY2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Switch_Regulator1",
|
|
||||||
"resource": "r1varsetpoint",
|
|
||||||
"domain": "switch",
|
|
||||||
"domain_data": {
|
|
||||||
"output": "R1VARSETPOINT"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Switch_KeyLock1",
|
|
||||||
"resource": "a1",
|
|
||||||
"domain": "switch",
|
|
||||||
"domain_data": {
|
|
||||||
"output": "A1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 5, true],
|
|
||||||
"name": "Switch_Group5",
|
|
||||||
"resource": "relay1",
|
|
||||||
"domain": "switch",
|
|
||||||
"domain_data": {
|
|
||||||
"output": "RELAY1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Cover_Outputs",
|
|
||||||
"resource": "outputs",
|
|
||||||
"domain": "cover",
|
|
||||||
"domain_data": {
|
|
||||||
"motor": "OUTPUTS",
|
|
||||||
"reverse_time": "RT1200"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Cover_Relays",
|
|
||||||
"resource": "motor1",
|
|
||||||
"domain": "cover",
|
|
||||||
"domain_data": {
|
|
||||||
"motor": "MOTOR1",
|
|
||||||
"reverse_time": "RT1200"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Climate1",
|
|
||||||
"resource": "var1.r1varsetpoint",
|
|
||||||
"domain": "climate",
|
|
||||||
"domain_data": {
|
|
||||||
"source": "VAR1",
|
|
||||||
"setpoint": "R1VARSETPOINT",
|
|
||||||
"lockable": true,
|
|
||||||
"min_temp": 0.0,
|
|
||||||
"max_temp": 40.0,
|
|
||||||
"unit_of_measurement": "°C"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -177,73 +62,6 @@
|
|||||||
"outputs": ["OUTPUT1", "OUTPUT2", "RELAY1"],
|
"outputs": ["OUTPUT1", "OUTPUT2", "RELAY1"],
|
||||||
"transition": 10000
|
"transition": 10000
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Sensor_LockRegulator1",
|
|
||||||
"resource": "r1varsetpoint",
|
|
||||||
"domain": "binary_sensor",
|
|
||||||
"domain_data": {
|
|
||||||
"source": "R1VARSETPOINT"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Binary_Sensor1",
|
|
||||||
"resource": "binsensor1",
|
|
||||||
"domain": "binary_sensor",
|
|
||||||
"domain_data": {
|
|
||||||
"source": "BINSENSOR1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Sensor_KeyLock",
|
|
||||||
"resource": "a5",
|
|
||||||
"domain": "binary_sensor",
|
|
||||||
"domain_data": {
|
|
||||||
"source": "A5"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Sensor_Var1",
|
|
||||||
"resource": "var1",
|
|
||||||
"domain": "sensor",
|
|
||||||
"domain_data": {
|
|
||||||
"source": "VAR1",
|
|
||||||
"unit_of_measurement": "°C"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Sensor_Setpoint1",
|
|
||||||
"resource": "r1varsetpoint",
|
|
||||||
"domain": "sensor",
|
|
||||||
"domain_data": {
|
|
||||||
"source": "R1VARSETPOINT",
|
|
||||||
"unit_of_measurement": "°C"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Sensor_Led6",
|
|
||||||
"resource": "led6",
|
|
||||||
"domain": "sensor",
|
|
||||||
"domain_data": {
|
|
||||||
"source": "LED6",
|
|
||||||
"unit_of_measurement": "NATIVE"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": [0, 7, false],
|
|
||||||
"name": "Sensor_LogicOp1",
|
|
||||||
"resource": "logicop1",
|
|
||||||
"domain": "sensor",
|
|
||||||
"domain_data": {
|
|
||||||
"source": "LOGICOP1",
|
|
||||||
"unit_of_measurement": "NATIVE"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
140
tests/components/lcn/snapshots/test_init.ambr
Normal file
140
tests/components/lcn/snapshots/test_init.ambr
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
# serializer version: 1
|
||||||
|
# name: test_migrate_1_1
|
||||||
|
dict({
|
||||||
|
'acknowledge': False,
|
||||||
|
'devices': list([
|
||||||
|
dict({
|
||||||
|
'address': tuple(
|
||||||
|
0,
|
||||||
|
7,
|
||||||
|
False,
|
||||||
|
),
|
||||||
|
'hardware_serial': -1,
|
||||||
|
'hardware_type': -1,
|
||||||
|
'name': 'TestModule',
|
||||||
|
'software_serial': -1,
|
||||||
|
}),
|
||||||
|
]),
|
||||||
|
'dim_mode': 'STEPS200',
|
||||||
|
'entities': list([
|
||||||
|
dict({
|
||||||
|
'address': tuple(
|
||||||
|
0,
|
||||||
|
7,
|
||||||
|
False,
|
||||||
|
),
|
||||||
|
'domain': 'light',
|
||||||
|
'domain_data': dict({
|
||||||
|
'dimmable': True,
|
||||||
|
'output': 'OUTPUT1',
|
||||||
|
'transition': 5.0,
|
||||||
|
}),
|
||||||
|
'name': 'Light_Output1',
|
||||||
|
'resource': 'output1',
|
||||||
|
}),
|
||||||
|
]),
|
||||||
|
'host': 'pchk',
|
||||||
|
'ip_address': '192.168.2.41',
|
||||||
|
'password': 'lcn',
|
||||||
|
'port': 4114,
|
||||||
|
'sk_num_tries': 0,
|
||||||
|
'username': 'lcn',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_migrate_1_2
|
||||||
|
dict({
|
||||||
|
'acknowledge': False,
|
||||||
|
'devices': list([
|
||||||
|
dict({
|
||||||
|
'address': tuple(
|
||||||
|
0,
|
||||||
|
7,
|
||||||
|
False,
|
||||||
|
),
|
||||||
|
'hardware_serial': -1,
|
||||||
|
'hardware_type': -1,
|
||||||
|
'name': 'TestModule',
|
||||||
|
'software_serial': -1,
|
||||||
|
}),
|
||||||
|
]),
|
||||||
|
'dim_mode': 'STEPS200',
|
||||||
|
'entities': list([
|
||||||
|
dict({
|
||||||
|
'address': tuple(
|
||||||
|
0,
|
||||||
|
7,
|
||||||
|
False,
|
||||||
|
),
|
||||||
|
'domain': 'light',
|
||||||
|
'domain_data': dict({
|
||||||
|
'dimmable': True,
|
||||||
|
'output': 'OUTPUT1',
|
||||||
|
'transition': 5.0,
|
||||||
|
}),
|
||||||
|
'name': 'Light_Output1',
|
||||||
|
'resource': 'output1',
|
||||||
|
}),
|
||||||
|
dict({
|
||||||
|
'address': tuple(
|
||||||
|
0,
|
||||||
|
7,
|
||||||
|
False,
|
||||||
|
),
|
||||||
|
'domain': 'light',
|
||||||
|
'domain_data': dict({
|
||||||
|
'dimmable': False,
|
||||||
|
'output': 'OUTPUT2',
|
||||||
|
'transition': 0.0,
|
||||||
|
}),
|
||||||
|
'name': 'Light_Output2',
|
||||||
|
'resource': 'output2',
|
||||||
|
}),
|
||||||
|
dict({
|
||||||
|
'address': tuple(
|
||||||
|
0,
|
||||||
|
7,
|
||||||
|
False,
|
||||||
|
),
|
||||||
|
'domain': 'scene',
|
||||||
|
'domain_data': dict({
|
||||||
|
'outputs': list([
|
||||||
|
'OUTPUT1',
|
||||||
|
'OUTPUT2',
|
||||||
|
'RELAY1',
|
||||||
|
]),
|
||||||
|
'register': 0,
|
||||||
|
'scene': 0,
|
||||||
|
'transition': 0.0,
|
||||||
|
}),
|
||||||
|
'name': 'Romantic',
|
||||||
|
'resource': '0.0',
|
||||||
|
}),
|
||||||
|
dict({
|
||||||
|
'address': tuple(
|
||||||
|
0,
|
||||||
|
7,
|
||||||
|
False,
|
||||||
|
),
|
||||||
|
'domain': 'scene',
|
||||||
|
'domain_data': dict({
|
||||||
|
'outputs': list([
|
||||||
|
'OUTPUT1',
|
||||||
|
'OUTPUT2',
|
||||||
|
'RELAY1',
|
||||||
|
]),
|
||||||
|
'register': 0,
|
||||||
|
'scene': 1,
|
||||||
|
'transition': 10.0,
|
||||||
|
}),
|
||||||
|
'name': 'Romantic Transition',
|
||||||
|
'resource': '0.1',
|
||||||
|
}),
|
||||||
|
]),
|
||||||
|
'host': 'pchk',
|
||||||
|
'ip_address': '192.168.2.41',
|
||||||
|
'password': 'lcn',
|
||||||
|
'port': 4114,
|
||||||
|
'sk_num_tries': 0,
|
||||||
|
'username': 'lcn',
|
||||||
|
})
|
||||||
|
# ---
|
@ -11,6 +11,7 @@ from pypck.connection import (
|
|||||||
)
|
)
|
||||||
from pypck.lcn_defs import LcnEvent
|
from pypck.lcn_defs import LcnEvent
|
||||||
import pytest
|
import pytest
|
||||||
|
from syrupy.assertion import SnapshotAssertion
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.components.lcn.const import DOMAIN
|
from homeassistant.components.lcn.const import DOMAIN
|
||||||
@ -134,7 +135,7 @@ async def test_async_entry_reload_on_host_event_received(
|
|||||||
|
|
||||||
|
|
||||||
@patch("homeassistant.components.lcn.PchkConnectionManager", MockPchkConnectionManager)
|
@patch("homeassistant.components.lcn.PchkConnectionManager", MockPchkConnectionManager)
|
||||||
async def test_migrate_1_1(hass: HomeAssistant, entry) -> None:
|
async def test_migrate_1_1(hass: HomeAssistant, snapshot: SnapshotAssertion) -> None:
|
||||||
"""Test migration config entry."""
|
"""Test migration config entry."""
|
||||||
entry_v1_1 = create_config_entry("pchk_v1_1", version=(1, 1))
|
entry_v1_1 = create_config_entry("pchk_v1_1", version=(1, 1))
|
||||||
entry_v1_1.add_to_hass(hass)
|
entry_v1_1.add_to_hass(hass)
|
||||||
@ -143,14 +144,15 @@ async def test_migrate_1_1(hass: HomeAssistant, entry) -> None:
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
entry_migrated = hass.config_entries.async_get_entry(entry_v1_1.entry_id)
|
entry_migrated = hass.config_entries.async_get_entry(entry_v1_1.entry_id)
|
||||||
|
|
||||||
assert entry_migrated.state is ConfigEntryState.LOADED
|
assert entry_migrated.state is ConfigEntryState.LOADED
|
||||||
assert entry_migrated.version == 2
|
assert entry_migrated.version == 2
|
||||||
assert entry_migrated.minor_version == 1
|
assert entry_migrated.minor_version == 1
|
||||||
assert entry_migrated.data == entry.data
|
assert entry_migrated.data == snapshot
|
||||||
|
|
||||||
|
|
||||||
@patch("homeassistant.components.lcn.PchkConnectionManager", MockPchkConnectionManager)
|
@patch("homeassistant.components.lcn.PchkConnectionManager", MockPchkConnectionManager)
|
||||||
async def test_migrate_1_2(hass: HomeAssistant, entry) -> None:
|
async def test_migrate_1_2(hass: HomeAssistant, snapshot: SnapshotAssertion) -> None:
|
||||||
"""Test migration config entry."""
|
"""Test migration config entry."""
|
||||||
entry_v1_2 = create_config_entry("pchk_v1_2", version=(1, 2))
|
entry_v1_2 = create_config_entry("pchk_v1_2", version=(1, 2))
|
||||||
entry_v1_2.add_to_hass(hass)
|
entry_v1_2.add_to_hass(hass)
|
||||||
@ -159,7 +161,8 @@ async def test_migrate_1_2(hass: HomeAssistant, entry) -> None:
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
entry_migrated = hass.config_entries.async_get_entry(entry_v1_2.entry_id)
|
entry_migrated = hass.config_entries.async_get_entry(entry_v1_2.entry_id)
|
||||||
|
|
||||||
assert entry_migrated.state is ConfigEntryState.LOADED
|
assert entry_migrated.state is ConfigEntryState.LOADED
|
||||||
assert entry_migrated.version == 2
|
assert entry_migrated.version == 2
|
||||||
assert entry_migrated.minor_version == 1
|
assert entry_migrated.minor_version == 1
|
||||||
assert entry_migrated.data == entry.data
|
assert entry_migrated.data == snapshot
|
||||||
|
Loading…
x
Reference in New Issue
Block a user