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
This commit is contained in:
Harald Welte 2020-02-20 18:48:22 +01:00
parent 3993c81b79
commit b12a0ffc03
1 changed files with 26 additions and 1 deletions

View File

@ -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() );