[RICPLT-2787] Complete automation tests for US 20/2120/1
authoris005q <idan.shalom@intl.att.com>
Sun, 29 Dec 2019 13:49:53 +0000 (15:49 +0200)
committeris005q <idan.shalom@intl.att.com>
Sun, 29 Dec 2019 13:50:03 +0000 (15:50 +0200)
Change-Id: I055e0efbf1c3bc29d6e776c5bdbc136700f35760
Signed-off-by: is005q <idan.shalom@intl.att.com>
Automation/Tests/Get_E2T_Instances/get_e2t_instances.robot
Automation/Tests/Scripts/e2mdbscripts.py
Automation/Tests/Unhappy/Get_E2T_Instances_DB_Error.robot [deleted file]

index dbafcfc..09bc6ca 100644 (file)
 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
 
 
 
index 7b9475b..6753f80 100644 (file)
@@ -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 (file)
index 9ab940f..0000000
+++ /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