Commit 59799229 authored by Hamza Baqa's avatar Hamza Baqa

Broken lines problem fixed and OV socket fixed

parent c57759fc
......@@ -5,6 +5,7 @@ from subprocess import call
from tabulate import tabulate
import ast
import json
import textwrap
print("The env vars are:")
......@@ -59,6 +60,10 @@ DOCKER_GW = os.environ['SEMTEST_ONTOLOGY_VALIDATOR_URL']
URL_to_send_validation = DOCKER_GW + "/SemTest/ontology/test"
print("I will send the request to : " + URL_to_send + " for the validation")
def wrap(line):
broken = textwrap.wrap(line, 80, break_long_words=False)
return '\n'.join(broken)
res = requests.post(URL_to_send_validation, data=JSON_to_Send)
val = ast.literal_eval(res.text)
......@@ -69,7 +74,7 @@ val_type_1_val = val1['results'][0]['value']
val_1_obj = []
val_1_obj.append(val_type_1)
if not val_type_1_val: val_type_1_val="Well Done !!"
val_1_obj.append(val_type_1_val)
val_1_obj.append(wrap(val_type_1_val))
val_type_2 = val1['results'][1]['type']
val_type_2_val = val1['results'][1]['value']
......@@ -77,7 +82,7 @@ val_type_2_val = val1['results'][1]['value']
val_2_obj = []
val_2_obj.append(val_type_2)
if not val_type_2_val: val_type_2_val="Well Done !!"
val_2_obj.append(val_type_2_val)
val_2_obj.append(wrap(val_type_2_val))
val_type_3 = val1['results'][2]['type']
val_type_3_val = val1['results'][2]['value']
......@@ -85,7 +90,7 @@ val_type_3_val = val1['results'][2]['value']
val_3_obj = []
val_3_obj.append(val_type_3)
if not val_type_3_val: val_type_3_val="Well Done !!"
val_3_obj.append(val_type_3_val)
val_3_obj.append(wrap(val_type_3_val))
to_send = []
......
......@@ -7,6 +7,7 @@ import os
import json
import socket
import re
import textwrap
......@@ -20,6 +21,9 @@ session_user.remove('myslice')
ioppytest_cli._ui_display_markdown_text(".............Sending queries............ ")
def wrap(line):
broken = textwrap.wrap(line, 80, break_long_words=False)
return '\n'.join(broken)
def is_http_url(s):
"""
......@@ -84,8 +88,8 @@ except:
val_1_obj = []
val_1_obj.append("Query result of :"+ conf_li_1[0] + ':' + conf_li_1[1] + " from: " + session_user[0])
val_1_obj.append(query_resp_1)
val_1_obj.append(wrap("Query result of :"+ conf_li_1[0] + ':' + conf_li_1[1] + " from: " + session_user[0]))
val_1_obj.append(wrap(query_resp_1))
#Read config file 2
......@@ -101,8 +105,8 @@ except:
ioppytest_cli._ui_display_markdown_text("Please check your Server")
val_2_obj = []
val_2_obj.append("Query result of :"+ conf_li_1[0] + ':' + conf_li_1[1] + " from: " + session_user[1])
val_2_obj.append(query_resp_2)
val_2_obj.append(wrap("Query result of :"+ conf_li_1[0] + ':' + conf_li_1[1] + " from: " + session_user[1]))
val_2_obj.append(wrap(query_resp_2))
#compare result
val_3_obj = []
......
......@@ -35,18 +35,20 @@ print("I will send the file to URL_to_send_validation")
ioppytest_cli._ui_display_markdown_text("Waiting for validation ............ ")
print('Preparing to send the file 1 to the OV to the address : ' + URL_to_send_validation )
#Upload file 1
file_1 = {'file': open(file_1_to_validate_path, 'rb')}
r_1 = requests.post(URL_to_send, files=file_1)
print('request 1 sent and the response ' + r_2.text)
r_1 = requests.post(URL_to_send_validation, files=file_1)
print('file 1 sent and the response ' + r_2.text)
j_1 = json.loads(r_1.text)
print('file 1 uploaded and it cointains these ontologies ' +j_1 )
print('Preparing to send the file 2 to the OV to the address : '+ URL_to_send_validation )
#Upload file 2
file_2 = {'file': open(file_2_to_validate_path, 'rb')}
r_2 = requests.post(URL_to_send, files=file_2)
print('request 2 sent and the response ' + r_2.text)
r_2 = requests.post(URL_to_send_validation, files=file_2)
print('file 2 sent and the response ' + r_2.text)
j_2 = json.loads(r_2.text)
print('file 1 uploaded and it cointains these ontologies ' +j_1 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment