resp.content->resp.text in Should Contain 93/90593/1
authorJamo Luhrsen <jluhrsen@gmail.com>
Tue, 23 Jun 2020 00:15:04 +0000 (17:15 -0700)
committerJamo Luhrsen <jluhrsen@gmail.com>
Tue, 23 Jun 2020 00:15:04 +0000 (17:15 -0700)
The new python3 upgrade breaks our old checks for
Should Contain when using ${resp.content}. The
erorr is:

TypeError: a bytes-like object is required, not 'str'

There will probably be lots of places to fix this.

JIRA: INTTEST-105
Signed-off-by: Jamo Luhrsen <jluhrsen@gmail.com>
Change-Id: I14726cef95e2d2e7355d6974eacb4646566aa7a5

csit/libraries/Utils.robot

index 8d4caf2d7a00beb096a134bccee91e9abacafdd8..7a4b62c0a3fbe6f9cbbe95d3dbb584e2b619e390 100644 (file)
@@ -87,8 +87,8 @@ Check Nodes Stats
     ...    strings are checked for existence.
     ${resp}    RequestsLibrary.Get Request    ${session}    ${OPERATIONAL_NODES_API}/node/${node}
     Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    flow-capable-node-connector-statistics
-    Should Contain    ${resp.content}    flow-table-statistics
+    Should Contain    ${resp.text}    flow-capable-node-connector-statistics
+    Should Contain    ${resp.text}    flow-table-statistics
 
 Check For Specific Number Of Elements At URI
     [Arguments]    ${uri}    ${element}    ${expected_count}    ${session}=session
@@ -97,7 +97,7 @@ Check For Specific Number Of Elements At URI
     ${resp}    RequestsLibrary.Get Request    ${session}    ${uri}
     Log    ${resp.content}
     Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain X Times    ${resp.content}    ${element}    ${expected_count}
+    Should Contain X Times    ${resp.text}    ${element}    ${expected_count}
 
 Log Content
     [Arguments]    ${resp_content}
@@ -115,7 +115,7 @@ Check For Elements At URI
     ...    ELSE    BuiltIn.Log    ${resp.content}
     Should Be Equal As Strings    ${resp.status_code}    200
     FOR    ${i}    IN    @{elements}
-        Should Contain    ${resp.content}    ${i}
+        Should Contain    ${resp.text}    ${i}
     END
 
 Check For Elements Not At URI
@@ -130,7 +130,7 @@ Check For Elements Not At URI
     BuiltIn.Run Keyword If    "${check_for_null}" == "True"    Builtin.Return From Keyword If    ${resp.status_code} == 404 or ${resp.status_code} == 409
     Should Be Equal As Strings    ${resp.status_code}    200
     FOR    ${i}    IN    @{elements}
-        Should Not Contain    ${resp.content}    ${i}
+        Should Not Contain    ${resp.text}    ${i}
     END
 
 Clean Mininet System