Use default docker prefix of CSIT env
[integration/csit.git] / tests / appc / healthcheck / gettime.robot
1 *** Settings ***
2 Library    Selenium2Library
3 Library    OperatingSystem
4 Library    DateTime
5 Library    String
6 ##Library    HttpLibrary.HTTP
7 Library    Collections
8
9
10 *** Keywords ***
11
12 Get Server time
13     [Documentation]    Getting server time to update the json request
14     [Arguments]     ${RequestFile}    
15     
16     ${date}=    Get Current Date    time_zone=local    result_format=%Y-%m-%dT%H:%M:%S.%fZ    exclude_millis=False 
17     
18     #updating the request file with the server time
19     ${file_content}=    OperatingSystem.Get File    ${RequestFile}
20         @{list}=    Split to lines  ${file_content} 
21         ${data}=    Get from list    ${list}    5
22         @{splitted_string}=    Split String    ${data}    :    1
23     ${time}=    Get From List    ${splitted_string}    1
24     Log    ${time}
25     @{splitted_string_time}=    Split String    ${time}    "    2
26     ${times1}=    Get From List    ${splitted_string_time}    1
27     Log    ${times1}
28     ${replaced_string}=    Replace String    ${data}    ${times1}    ${date}
29     @{list1}=    Split to lines  ${file_content} 
30         Remove from list    ${list1}    5
31         Insert into list    ${list1}    5     ${replaced_string}
32         Remove File     ${RequestFile}                                              
33         :FOR    ${line}    IN    @{list1}
34         \      Append to File    ${RequestFile}    ${line}    encoding=UTF-8
35         \      Append to File    ${RequestFile}    ${\n}    encoding=UTF-8
36               
37    
38
39  
40