From b12a0ffc03283bf089810e7d48d3dbed90704750 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 20 Feb 2020 18:48:22 +0100 Subject: [PATCH] remsim: Add RemsimServer_Tests.TC_slotmap_add_out_of_range() Validate if osmo-remsim-server permits out-of-range integers in REST. Change-Id: I449541420a15826ed0d2f1460e3ca4b3468662c3 --- remsim/RemsimServer_Tests.ttcn | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/remsim/RemsimServer_Tests.ttcn b/remsim/RemsimServer_Tests.ttcn index e154cc298..bada70a5f 100644 --- a/remsim/RemsimServer_Tests.ttcn +++ b/remsim/RemsimServer_Tests.ttcn @@ -260,6 +260,31 @@ testcase TC_slotmap_add() runs on test_CT { f_ensure_slotmap_exists_only(sm.client, sm.bank, NEW); } +/* test adding a single slotmap with out-of-range values */ +testcase TC_slotmap_add_out_of_range() runs on test_CT { + f_rsres_init(); + + var HTTPMessage http_resp; + var charstring body; + + body := "{ \"bank\": { \"bankId\": 10000, \"slotNr\": 2 }, \"client\": { \"clientId\": 3, \"slotNr\": 4 } }"; + http_resp := f_http_transact(url := "/api/backend/v1/slotmaps", method := "POST", + body := body, exp := tr_HTTP_Resp(400)); + + body := "{ \"bank\": { \"bankId\": 100, \"slotNr\": 2000 }, \"client\": { \"clientId\": 3, \"slotNr\": 4 } }"; + http_resp := f_http_transact(url := "/api/backend/v1/slotmaps", method := "POST", + body := body, exp := tr_HTTP_Resp(400)); + + body := "{ \"bank\": { \"bankId\": 100, \"slotNr\": 2 }, \"client\": { \"clientId\": 3000, \"slotNr\": 4 } }"; + http_resp := f_http_transact(url := "/api/backend/v1/slotmaps", method := "POST", + body := body, exp := tr_HTTP_Resp(400)); + + body := "{ \"bank\": { \"bankId\": 100, \"slotNr\": 2 }, \"client\": { \"clientId\": 3, \"slotNr\": 4000 } }"; + http_resp := f_http_transact(url := "/api/backend/v1/slotmaps", method := "POST", + body := body, exp := tr_HTTP_Resp(400)); +} + + /* test adding a slotmap and then connecting a client + bankd */ testcase TC_slotmap_add_conn_cl_b() runs on test_CT { /* Simulate one client */ @@ -521,7 +546,6 @@ testcase TC_slotmap_add_active_bank() runs on test_CT { /* TODO * - connect client w/slotmap; delete slotmap via REST (see if it is deleted) * - don't acknowledge delete from client, disconnect client (see if slotmap is deleted) - * - create slotmap with integers out of range via REST * - connect from unknown client (name not known, no clientId provisioned? * - add client name/ID mappings from REST API? @@ -534,6 +558,7 @@ control { execute( TC_connect_bank() ); execute( TC_slotmap_add() ); execute( TC_slotmap_add_conn_cl_b() ); + execute( TC_slotmap_add_out_of_range() ); execute( TC_conn_cl_b_slotmap_add() ); execute( TC_slotmap_del_new() ); execute( TC_slotmap_del_nonexistant() );