From 51c97f16d94d297c86f1a2e2f90c4435251d8746 Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Sat, 27 Feb 2021 13:51:49 +0100 Subject: [PATCH] Add mqtt username and password to tests --- test/config.yaml | 7 ++++--- test/test_colors.tavern.yaml | 3 +++ test/test_label.tavern.yaml | 3 +++ test/test_mqtt.tavern.yaml | 8 +++++--- test/test_obj.tavern.yaml | 31 ++++++++++++++++++++++++++++--- test/test_value_str.tavern.yaml | 14 ++++++++------ 6 files changed, 51 insertions(+), 15 deletions(-) diff --git a/test/config.yaml b/test/config.yaml index 123df340..8e75a5fc 100644 --- a/test/config.yaml +++ b/test/config.yaml @@ -1,10 +1,11 @@ # config.yaml --- - name: Common test information description: Connection information for MQTT Client variables: - host: 10.4.0.5 + host: homeassistant.local + username: hasp + password: hasp port: 1883 - plate: plate35 \ No newline at end of file + plate: plate35 diff --git a/test/test_colors.tavern.yaml b/test/test_colors.tavern.yaml index 172fff36..8db18eaf 100644 --- a/test/test_colors.tavern.yaml +++ b/test/test_colors.tavern.yaml @@ -13,6 +13,9 @@ paho-mqtt: host: "{host}" port: !int "{port:d}" timeout: 3 + auth: + username: "{username}" + password: "{password}" marks: - parametrize: diff --git a/test/test_label.tavern.yaml b/test/test_label.tavern.yaml index f5dace3d..207baafe 100644 --- a/test/test_label.tavern.yaml +++ b/test/test_label.tavern.yaml @@ -13,6 +13,9 @@ paho-mqtt: &mqtt_spec host: "{host}" port: !int "{port:d}" timeout: 1 + auth: + username: "{username}" + password: "{password}" stages: - name: Page 1 diff --git a/test/test_mqtt.tavern.yaml b/test/test_mqtt.tavern.yaml index 2e103523..c923b848 100644 --- a/test/test_mqtt.tavern.yaml +++ b/test/test_mqtt.tavern.yaml @@ -1,6 +1,5 @@ # test_page.tavern.yaml --- - test_name: Page command includes: @@ -14,6 +13,9 @@ paho-mqtt: host: "{host}" port: !int "{port:d}" timeout: 3 + auth: + username: "{username}" + password: "{password}" stages: - name: step 1 - Page test @@ -46,7 +48,7 @@ stages: - name: step 4 - Page test mqtt_publish: topic: hasp/{plate}/command/json - payload: "[\"page=1\"]" + payload: '["page=1"]' mqtt_response: topic: hasp/{plate}/state/page payload: "1" @@ -55,7 +57,7 @@ stages: - name: step 5 - Page test mqtt_publish: topic: hasp/{plate}/command/json - payload: "[\"page 300\"]" + payload: '["page 300"]' mqtt_response: topic: hasp/{plate}/state/page payload: "1" diff --git a/test/test_obj.tavern.yaml b/test/test_obj.tavern.yaml index 9fe6ae5a..684e7fd5 100644 --- a/test/test_obj.tavern.yaml +++ b/test/test_obj.tavern.yaml @@ -13,6 +13,9 @@ paho-mqtt: host: "{host}" port: !int "{port:d}" timeout: 3 + auth: + username: "{username}" + password: "{password}" marks: - parametrize: @@ -52,8 +55,30 @@ marks: vals: - [1, 0, 120, 121, 122, 123, 0, 255, "I'm sorry.", "louie"] - [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: - name: Page 1 @@ -202,7 +227,7 @@ stages: json: radius: !int "{radius:d}" timeout: 1 - + - name: Set value_str mqtt_publish: topic: "hasp/{plate}/command/p1b1.value_str" diff --git a/test/test_value_str.tavern.yaml b/test/test_value_str.tavern.yaml index e3448654..f22688e8 100644 --- a/test/test_value_str.tavern.yaml +++ b/test/test_value_str.tavern.yaml @@ -1,6 +1,5 @@ # test_value_str.tavern.yaml --- - test_name: Obj Standard Properties includes: @@ -14,6 +13,9 @@ paho-mqtt: host: "{host}" port: !int "{port:d}" timeout: 3 + auth: + username: "{username}" + password: "{password}" marks: - parametrize: @@ -26,14 +28,14 @@ marks: - 30 - 31 - 32 -# - 33 -# - 40 + # - 33 + # - 40 - 41 - 50 - 51 - 91 -# - 90 -# - 1 + # - 90 + # - 1 - 2 - 71 - 80 @@ -93,7 +95,7 @@ stages: x: 128 y: 128 delay_after: 0 - + - name: Set value_str mqtt_publish: topic: "hasp/{plate}/command/p[1].b[1].value_str"