Add mqtt username and password to tests

This commit is contained in:
fvanroie 2021-02-27 13:51:49 +01:00
parent 80052140f3
commit 51c97f16d9
6 changed files with 51 additions and 15 deletions

View File

@ -1,10 +1,11 @@
# config.yaml # config.yaml
--- ---
name: Common test information name: Common test information
description: Connection information for MQTT Client description: Connection information for MQTT Client
variables: variables:
host: 10.4.0.5 host: homeassistant.local
username: hasp
password: hasp
port: 1883 port: 1883
plate: plate35 plate: plate35

View File

@ -13,6 +13,9 @@ paho-mqtt:
host: "{host}" host: "{host}"
port: !int "{port:d}" port: !int "{port:d}"
timeout: 3 timeout: 3
auth:
username: "{username}"
password: "{password}"
marks: marks:
- parametrize: - parametrize:

View File

@ -13,6 +13,9 @@ paho-mqtt: &mqtt_spec
host: "{host}" host: "{host}"
port: !int "{port:d}" port: !int "{port:d}"
timeout: 1 timeout: 1
auth:
username: "{username}"
password: "{password}"
stages: stages:
- name: Page 1 - name: Page 1

View File

@ -1,6 +1,5 @@
# test_page.tavern.yaml # test_page.tavern.yaml
--- ---
test_name: Page command test_name: Page command
includes: includes:
@ -14,6 +13,9 @@ paho-mqtt:
host: "{host}" host: "{host}"
port: !int "{port:d}" port: !int "{port:d}"
timeout: 3 timeout: 3
auth:
username: "{username}"
password: "{password}"
stages: stages:
- name: step 1 - Page test - name: step 1 - Page test
@ -46,7 +48,7 @@ stages:
- name: step 4 - Page test - name: step 4 - Page test
mqtt_publish: mqtt_publish:
topic: hasp/{plate}/command/json topic: hasp/{plate}/command/json
payload: "[\"page=1\"]" payload: '["page=1"]'
mqtt_response: mqtt_response:
topic: hasp/{plate}/state/page topic: hasp/{plate}/state/page
payload: "1" payload: "1"
@ -55,7 +57,7 @@ stages:
- name: step 5 - Page test - name: step 5 - Page test
mqtt_publish: mqtt_publish:
topic: hasp/{plate}/command/json topic: hasp/{plate}/command/json
payload: "[\"page 300\"]" payload: '["page 300"]'
mqtt_response: mqtt_response:
topic: hasp/{plate}/state/page topic: hasp/{plate}/state/page
payload: "1" payload: "1"

View File

@ -13,6 +13,9 @@ paho-mqtt:
host: "{host}" host: "{host}"
port: !int "{port:d}" port: !int "{port:d}"
timeout: 3 timeout: 3
auth:
username: "{username}"
password: "{password}"
marks: marks:
- parametrize: - parametrize:
@ -52,8 +55,30 @@ marks:
vals: vals:
- [1, 0, 120, 121, 122, 123, 0, 255, "I'm sorry.", "louie"] - [1, 0, 120, 121, 122, 123, 0, 255, "I'm sorry.", "louie"]
- [1, 0, -10, -10, 256, 257, 1, 64, "louie", " The cat stretched."] - [1, 0, -10, -10, 256, 257, 1, 64, "louie", " The cat stretched."]
- [0, 1, 1024, 1025, 1026, 1027, 5, 0, "The pipe began to rust while new.", ""] - [
- [0, 1, 80, 81, 82, 83, 32535, 192, "" ," Oak is strong and also gives shade."] 0,
1,
1024,
1025,
1026,
1027,
5,
0,
"The pipe began to rust while new.",
"",
]
- [
0,
1,
80,
81,
82,
83,
32535,
192,
"",
" Oak is strong and also gives shade.",
]
stages: stages:
- name: Page 1 - name: Page 1
@ -202,7 +227,7 @@ stages:
json: json:
radius: !int "{radius:d}" radius: !int "{radius:d}"
timeout: 1 timeout: 1
- name: Set value_str - name: Set value_str
mqtt_publish: mqtt_publish:
topic: "hasp/{plate}/command/p1b1.value_str" topic: "hasp/{plate}/command/p1b1.value_str"

View File

@ -1,6 +1,5 @@
# test_value_str.tavern.yaml # test_value_str.tavern.yaml
--- ---
test_name: Obj Standard Properties test_name: Obj Standard Properties
includes: includes:
@ -14,6 +13,9 @@ paho-mqtt:
host: "{host}" host: "{host}"
port: !int "{port:d}" port: !int "{port:d}"
timeout: 3 timeout: 3
auth:
username: "{username}"
password: "{password}"
marks: marks:
- parametrize: - parametrize:
@ -26,14 +28,14 @@ marks:
- 30 - 30
- 31 - 31
- 32 - 32
# - 33 # - 33
# - 40 # - 40
- 41 - 41
- 50 - 50
- 51 - 51
- 91 - 91
# - 90 # - 90
# - 1 # - 1
- 2 - 2
- 71 - 71
- 80 - 80
@ -93,7 +95,7 @@ stages:
x: 128 x: 128
y: 128 y: 128
delay_after: 0 delay_after: 0
- name: Set value_str - name: Set value_str
mqtt_publish: mqtt_publish:
topic: "hasp/{plate}/command/p[1].b[1].value_str" topic: "hasp/{plate}/command/p[1].b[1].value_str"