Browse Source

- improve test for userblacklist, now with empty prefix
- spelling fix in 19.cfg


git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3770 689a6050-402a-0410-94f2-e92a70836424

Henning Westerholt 17 years ago
parent
commit
f1329b600f
2 changed files with 20 additions and 4 deletions
  1. 1 1
      test/unit/19.cfg
  2. 19 3
      test/unit/25.sh

+ 1 - 1
test/unit/19.cfg

@@ -9,7 +9,7 @@ port=5059
 dns=no
 rev_dns=no
 
-#-----------------------Loading Modiules-------------------------------------
+#-----------------------Loading Modules-------------------------------------
 mpath="../modules/"
 loadmodule "db_mysql/db_mysql.so"
 loadmodule "usrloc/usrloc.so"

+ 19 - 3
test/unit/25.sh

@@ -32,6 +32,7 @@ CFG=25.cfg
 
 MYSQL="mysql openser -u openser --password=openserrw -e"
 
+
 # add an registrar entry to the db;
 $MYSQL "insert into location (username,contact,socket,user_agent,cseq,q) values (\"49721123456789\",\"sip:123456789@localhost\",\"udp:127.0.0.1:5060\",\"ser_test\",1,-1);"
 
@@ -41,6 +42,8 @@ $MYSQL "insert into location (username,contact,socket,user_agent,cseq,q) values
 
 $MYSQL "insert into location (username,contact,socket,user_agent,cseq,q) values (\"49721123456786\",\"sip:123456786@localhost\",\"udp:127.0.0.1:5060\",\"ser_test\",1,-1);"
 
+$MYSQL "insert into location (username,contact,socket,user_agent,cseq,q) values (\"49721123456785\",\"sip:223456789@localhost\",\"udp:127.0.0.1:5060\",\"ser_test\",1,-1);"
+
 
 # setup userblacklist, first some dummy data
 $MYSQL "insert into userblacklist (username, domain, prefix, whitelist, comment) values ('494675454','','49900','0','_test_');"
@@ -54,6 +57,9 @@ $MYSQL "insert into userblacklist (username, domain, prefix, whitelist, comment)
 # and the global ones
 $MYSQL "insert into globalblacklist (prefix, whitelist, comment) values ('123456787','0','_test_');"
 $MYSQL "insert into globalblacklist (prefix, whitelist, comment) values ('123456','0','_test_');"
+$MYSQL "insert into globalblacklist (prefix, whitelist, comment) values ('1','1','_test_');"
+$MYSQL "insert into globalblacklist (prefix, whitelist, comment) values ('','0','_test_');"
+
 
 ../openser -w . -f $CFG &> /dev/null
 sleep 1
@@ -98,11 +104,21 @@ if [ "$ret" -eq 0 ] ; then
 fi;
 
 if [ "$ret" -eq 1 ] ; then
-	ret=0
-else
-	ret=1
+	sipp -sn uas -bg -i localhost -m 1 -f 2 -p 5060 &> /dev/null
+	sipp -sn uac -s 49721123456785 127.0.0.1:5059 -i 127.0.0.1 -m 1 -f 2 -p 5061 &> /dev/null
+	ret=$?
 fi;
 
+$MYSQL "insert into globalblacklist (prefix, whitelist, comment) values ('2','1','_test_');"
+openserctl fifo reload_blacklist
+
+if [ "$ret" -eq 1 ] ; then
+	sipp -sn uas -bg -i localhost -m 1 -f 2 -p 5060 &> /dev/null
+	sipp -sn uac -s 49721123456785 127.0.0.1:5059 -i 127.0.0.1 -m 1 -f 2 -p 5061 &> /dev/null
+	ret=$?
+fi;
+
+
 # cleanup:
 killall -9 sipp > /dev/null 2>&1
 killall -9 openser > /dev/null 2>&1