From 28b8f5bdd1fa64dbb69a1fd7e8c132eb28e32cfa Mon Sep 17 00:00:00 2001 From: is005q Date: Sun, 29 Dec 2019 15:49:53 +0200 Subject: [PATCH] [RICPLT-2787] Complete automation tests for US Change-Id: I055e0efbf1c3bc29d6e776c5bdbc136700f35760 Signed-off-by: is005q --- .../Get_E2T_Instances/get_e2t_instances.robot | 18 ++++-------- Automation/Tests/Scripts/e2mdbscripts.py | 7 +++++ .../Tests/Unhappy/Get_E2T_Instances_DB_Error.robot | 32 ---------------------- 3 files changed, 13 insertions(+), 44 deletions(-) delete mode 100644 Automation/Tests/Unhappy/Get_E2T_Instances_DB_Error.robot diff --git a/Automation/Tests/Get_E2T_Instances/get_e2t_instances.robot b/Automation/Tests/Get_E2T_Instances/get_e2t_instances.robot index dbafcfc..09bc6ca 100644 --- a/Automation/Tests/Get_E2T_Instances/get_e2t_instances.robot +++ b/Automation/Tests/Get_E2T_Instances/get_e2t_instances.robot @@ -20,31 +20,25 @@ Suite Setup Prepare Enviorment Resource ../Resource/Keywords.robot Resource ../Resource/resource.robot +Resource ../Resource/scripts_variables.robot Library REST ${url} Library RequestsLibrary Library Collections Library OperatingSystem Library json +Library ../Scripts/e2mdbscripts.py *** Test Cases *** -Get E2T instances 1st call +Get E2T instances + ${result} e2mdbscripts.populate_e2t_instances_in_e2m_db_for_get_e2t_instances_tc Create Session getE2tInstances ${url} ${headers}= Create Dictionary Accept=application/json ${resp}= Get Request getE2tInstances /v1/e2t/list headers=${headers} Should Be Equal As Strings ${resp.status_code} 200 - Should Be Equal As Strings ${resp.content} [{"e2tAddress":"e2t.att.com:38000","ranNames":[]}] - -Get E2T instances after one setup - - Post Request setup node b x-2 - Integer response status 204 - Create Session getE2tInstances ${url} - ${headers}= Create Dictionary Accept=application/json - ${resp}= Get Request getE2tInstances /v1/e2t/list headers=${headers} - Should Be Equal As Strings ${resp.status_code} 200 - Should Be Equal As Strings ${resp.content} [{\"e2tAddress\":\"e2t.att.com:38000\",\"ranNames\":[\"test1\"]}] + Should Be Equal As Strings ${resp.content} [{"e2tAddress":"e2t.att.com:38000","ranNames":["test1","test2","test3"]},{"e2tAddress":"e2t.att.com:38001","ranNames":[]}] + ${flush} cleanup_db.flush diff --git a/Automation/Tests/Scripts/e2mdbscripts.py b/Automation/Tests/Scripts/e2mdbscripts.py index 7b9475b..6753f80 100644 --- a/Automation/Tests/Scripts/e2mdbscripts.py +++ b/Automation/Tests/Scripts/e2mdbscripts.py @@ -33,6 +33,13 @@ def verify_ran_is_associated_with_e2t_instance(ranName, e2tAddress): assocRanList = e2tInstanceDic.get("associatedRanList") return ranName in assocRanList +def populate_e2t_instances_in_e2m_db_for_get_e2t_instances_tc(): + r = getRedisClientDecodeResponse() + r.set("{e2Manager},E2TAddresses", "[\"e2t.att.com:38000\",\"e2t.att.com:38001\"]") + r.set("{e2Manager},E2TInstance:e2t.att.com:38000", "{\"address\":\"e2t.att.com:38000\",\"associatedRanList\":[\"test1\",\"test2\",\"test3\"],\"keepAliveTimestamp\":1577619310484022369,\"state\":\"ACTIVE\"}") + r.set("{e2Manager},E2TInstance:e2t.att.com:38001", "{\"address\":\"e2t.att.com:38001\",\"associatedRanList\":[],\"keepAliveTimestamp\":1577619310484022369,\"state\":\"ACTIVE\"}") + return True + # def dissociate_ran_from_e2tInstance(ranName, e2tAddress): # r = getRedisClientDecodeResponse() # e2tInstanceJson = r.get("{e2Manager},E2TInstance:"+e2tAddress) diff --git a/Automation/Tests/Unhappy/Get_E2T_Instances_DB_Error.robot b/Automation/Tests/Unhappy/Get_E2T_Instances_DB_Error.robot deleted file mode 100644 index 9ab940f..0000000 --- a/Automation/Tests/Unhappy/Get_E2T_Instances_DB_Error.robot +++ /dev/null @@ -1,32 +0,0 @@ -############################################################################## -# -# Copyright (c) 2019 AT&T Intellectual Property. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -############################################################################## - -*** Settings *** -Suite Setup Prepare Enviorment -Resource ../Resource/Keywords.robot -Resource ../Resource/resource.robot -Library REST ${url} -Suite Teardown Start Dbass - -*** Test Cases *** -Get All E2T Instances DB Error - 500 - Stop Dbass - GET /v1/e2t/list - Integer response status 500 - Integer response body errorCode 500 - String response body errorMessage RNIB error \ No newline at end of file -- 2.16.6