changeset 496:f78f7ee6b660

fix httpclient
author Alain Mazy <am@osimis.io>
date Wed, 17 Aug 2022 13:36:14 +0200
parents 75d8a5261f82
children c8f9a2dd486d
files Database/Lua/HttpClient.lua Tests/Tests.py
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Database/Lua/HttpClient.lua	Wed Aug 17 09:37:47 2022 +0200
+++ b/Database/Lua/HttpClient.lua	Wed Aug 17 13:36:14 2022 +0200
@@ -66,7 +66,6 @@
 while retry > 0 and response == nil do
 	print("HttpClient test: GET to httpbin.org")
 	response = ParseJson(HttpGet('http://httpbin.org/get', httpHeaders))
-	sleep(1)
 end
 testSucceeded = testSucceeded and (response['headers']['Content-Type'] == 'application/json' and response['headers']['Toto'] == 'Tutu')
 if not testSucceeded then print('Failed in HttpGet') PrintRecursive(response) end
--- a/Tests/Tests.py	Wed Aug 17 09:37:47 2022 +0200
+++ b/Tests/Tests.py	Wed Aug 17 13:36:14 2022 +0200
@@ -3908,13 +3908,15 @@
 
 
     def test_httpClient_lua(self):
-        retries = 3
+        retries = 4
         result = ''
         
         with open(GetDatabasePath('Lua/HttpClient.lua'), 'r') as f:
+            scriptContent = f.read()
             # retry since this test sometimes fails if httpbin.org is unresponsive
             while retries > 0 and not ('OK' in result):
-                result = DoPost(_REMOTE, '/tools/execute-script', f.read(), 'application/lua')
+                print("Executing lua script HttpClient.lua")
+                result = DoPost(_REMOTE, '/tools/execute-script', scriptContent, 'application/lua')
                 retries -= 1
 
         self.assertIn('OK', result)