summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2016-04-03 18:13:04 +0200
committerAlfred E. Heggestad <aeh@db.org>2016-04-03 18:13:04 +0200
commitc9f404dd73c4f936aa763e81a4d0f908004b7d2e (patch)
treed12521b446faf791e866b2d26bc696e913061757 /test
parent31baf6937aee6f449a6675e102d6f0831bfb1fbe (diff)
auth test: add all transports
Diffstat (limited to 'test')
-rw-r--r--test/sip/sipsrv.c2
-rw-r--r--test/sip/sipsrv.h2
-rw-r--r--test/ua.c33
3 files changed, 28 insertions, 9 deletions
diff --git a/test/sip/sipsrv.c b/test/sip/sipsrv.c
index 8d9bd8e..686d587 100644
--- a/test/sip/sipsrv.c
+++ b/test/sip/sipsrv.c
@@ -1,5 +1,5 @@
/**
- * @file mock/sipsrv.c Mock SIP server
+ * @file sip/sipsrv.c Mock SIP server
*
* Copyright (C) 2010 - 2015 Creytiv.com
*/
diff --git a/test/sip/sipsrv.h b/test/sip/sipsrv.h
index 4690ffe..aa136e0 100644
--- a/test/sip/sipsrv.h
+++ b/test/sip/sipsrv.h
@@ -1,5 +1,5 @@
/**
- * @file mock/sipsrv.h Mock SIP server -- interface
+ * @file sip/sipsrv.h Mock SIP server -- interface
*
* Copyright (C) 2010 - 2016 Creytiv.com
*/
diff --git a/test/ua.c b/test/ua.c
index 11cd020..2cfbce8 100644
--- a/test/ua.c
+++ b/test/ua.c
@@ -348,10 +348,9 @@ int test_ua_register_dns(void)
#define PASS "password"
#define DOMAIN "localhost"
-int test_ua_register_auth(void)
+static int reg_auth(enum sip_transp tp)
{
struct sa laddr;
- enum sip_transp tp = SIP_TRANSP_UDP;
struct test t;
char aor[256];
int err;
@@ -379,16 +378,14 @@ int test_ua_register_auth(void)
/* NOTE: angel brackets needed to parse ;transport parameter */
if (re_snprintf(aor, sizeof(aor),
- "<sip:%s:%s@%s>;outbound=\"sip:%J\"",
+ "<sip:%s:%s@%s>;outbound=\"sip:%J;transport=%s\"",
USER,
PASS,
DOMAIN,
- &laddr) < 0)
+ &laddr,
+ sip_transp_name(tp)) < 0)
return ENOMEM;
- err = ua_init("test", true, true, true, false);
- TEST_ERR(err);
-
err = ua_alloc(&t.ua, aor);
TEST_ERR(err);
@@ -417,6 +414,28 @@ int test_ua_register_auth(void)
uag_event_unregister(ua_event_handler);
test_reset(&t);
+
+ return err;
+}
+
+
+int test_ua_register_auth(void)
+{
+ int err;
+
+ err = ua_init("test", true, true, true, false);
+ TEST_ERR(err);
+
+ err |= reg_auth(SIP_TRANSP_UDP);
+ TEST_ERR(err);
+ err |= reg_auth(SIP_TRANSP_TCP);
+ TEST_ERR(err);
+#ifdef USE_TLS
+ err |= reg_auth(SIP_TRANSP_TLS);
+ TEST_ERR(err);
+#endif
+
+ out:
ua_stop_all(true);
ua_close();