Skip to content

Commit 3767400

Browse files
registrar: fix unit tests
1 parent 1a753be commit 3767400

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

modules/registrar/test/test.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,14 @@ static void test_lookup(void)
6767
"mAq9Px0UY8YjVmo2LnmCocmFRBU0gPMV2ebheGGWCc");
6868
str ct2 = str_init("sip:[email protected]");
6969
struct sip_msg msg;
70+
struct lookup_flags flags;
71+
72+
memset(&flags, 0, sizeof flags);
7073

7174
ok(ul.register_udomain("location", &d) == 0, "get 'location' udomain");
7275

7376
mk_sip_req("INVITE", "sip:alice@localhost", &msg);
74-
ok(reg_lookup(&msg, d, _str(""), NULL) == LOOKUP_NO_RESULTS, "lookup-1");
77+
ok(reg_lookup(&msg, d, NULL, NULL) == LOOKUP_NO_RESULTS, "lookup-1");
7578

7679
ul.lock_udomain(d, &aor);
7780
ok(ul.insert_urecord(d, &aor, &r, 0) == 0, "create AoR");
@@ -81,18 +84,21 @@ static void test_lookup(void)
8184
ok(ul.insert_ucontact(r, &ct2, &ci, NULL, 1, &c) == 0, "insert Contact");
8285
ul.unlock_udomain(d, &aor);
8386

84-
ok(reg_lookup(&msg, d, _str(""), NULL) == LOOKUP_OK, "lookup-2");
87+
ok(reg_lookup(&msg, d, NULL, NULL) == LOOKUP_OK, "lookup-2");
8588

8689
set_ruri(&msg, &aor_ruri);
87-
ok(reg_lookup(&msg, d, _str("m"), NULL) == LOOKUP_METHOD_UNSUP, "lookup-3");
90+
flags.flags = REG_LOOKUP_METHODFILTER_FLAG;
91+
ok(reg_lookup(&msg, d, &flags, NULL) == LOOKUP_METHOD_UNSUP,
92+
"lookup-3");
8893

8994
c->methods = ALL_METHODS;
9095

9196
set_ruri(&msg, &aor_ruri);
92-
ok(reg_lookup(&msg, d, _str(""), NULL) == LOOKUP_OK, "lookup-4");
97+
ok(reg_lookup(&msg, d, NULL, NULL) == LOOKUP_OK, "lookup-4");
9398

9499
set_ruri(&msg, &aor_ruri);
95-
ok(reg_lookup(&msg, d, _str("m"), NULL) == LOOKUP_OK, "lookup-5");
100+
ok(reg_lookup(&msg, d, &flags, NULL) == LOOKUP_OK,
101+
"lookup-5");
96102

97103
ok(ul.delete_ucontact(r, c, NULL, 0) == 0, "delete ucontact");
98104

@@ -101,13 +107,13 @@ static void test_lookup(void)
101107
ok(ul.insert_ucontact(r, &ct1, &ci, NULL, 1, &c) == 0, "insert ct1 (PN)");
102108

103109
set_ruri(&msg, &aor_ruri);
104-
ok(reg_lookup(&msg, d, _str(""), NULL) == LOOKUP_PN_SENT, "lookup-6");
110+
ok(reg_lookup(&msg, d, NULL, NULL) == LOOKUP_PN_SENT, "lookup-6");
105111

106112
fill_ucontact_info(&ci);
107113
ok(ul.insert_ucontact(r, &ct2, &ci, NULL, 1, &c) == 0, "insert ct2 (normal)");
108114

109115
set_ruri(&msg, &aor_ruri);
110-
ok(reg_lookup(&msg, d, _str(""), NULL) == LOOKUP_OK, "lookup-7");
116+
ok(reg_lookup(&msg, d, NULL, NULL) == LOOKUP_OK, "lookup-7");
111117

112118
/* the PN contact should just trigger a PN without becoming a branch */
113119
ok(str_match(&msg.new_uri, &ct2), "lookup-7: R-URI is ct2");
@@ -135,7 +141,8 @@ static void test_lookup(void)
135141
ok(append_branch(NULL, &ruri2, NULL, NULL, 1, 0, NULL) == 1, "append AoR-3");
136142

137143
set_ruri(&msg, &aor_ruri);
138-
ok(reg_lookup(&msg, d, _str("r"), NULL) == LOOKUP_OK, "lookup-8");
144+
flags.flags = REG_BRANCH_AOR_LOOKUP_FLAG;
145+
ok(reg_lookup(&msg, d, &flags, NULL) == LOOKUP_OK, "lookup-8");
139146
ok(get_nr_branches() == 1, "get-nr-branches");
140147
}
141148
}

0 commit comments

Comments
 (0)