Make tests run again.
authorLinus Nordberg <linus@nordu.net>
Mon, 28 Feb 2011 16:49:29 +0000 (17:49 +0100)
committerLinus Nordberg <linus@nordu.net>
Mon, 28 Feb 2011 16:49:29 +0000 (17:49 +0100)
NOTE: 2 exceptions ATM.

lib/tests/README [new file with mode: 0644]
lib/tests/test-udp.c

diff --git a/lib/tests/README b/lib/tests/README
new file mode 100644 (file)
index 0000000..8280b9e
--- /dev/null
@@ -0,0 +1,24 @@
+Build
+-----
+
+In order to build the tests, you'll need libcgreen
+(http://www.lastcraft.com/cgreen.php).
+
+
+Run
+---
+
+NOTE: To run the tests you need 
+- a RADIUS server running at localhost:1820 with shared sekret
+  "sikrit" configured (or whatever "test-udp-auth" in test.conf says)
+- a user "molgan" with password "password" present in the RADIUS
+  database
+This requirement will disappear in the future.
+
+Run the tests by typing
+
+  ./test-udp
+
+The output should be something like
+
+  Completed "main": 32 passes, 0 failures, 0 exceptions.
index a40d31c..f264a51 100644 (file)
@@ -17,12 +17,13 @@ authenticate (struct rs_connection *conn, const char *user, const char *pw)
   struct rs_packet *msg, *resp;
 
   assert_true (rs_request_create (conn, &req) == 0);
-  assert_true (rs_packet_create_auth_request (conn, &msg, user, pw) == 0);
-  assert_true (rs_request_send (req, msg, &resp) == 0);
+  assert_true (rs_packet_create_authn_request (conn, &msg, user, pw) == 0);
+  rs_request_add_reqpkt (req, msg);
+  assert_true (rs_request_send (req, &resp) == 0);
   //printf ("%s\n", rs_err_msg (rs_err_conn_pop (conn), 1));
   assert_true (rs_packet_frpkt (resp)->code == PW_AUTHENTICATION_ACK);
 
-  rs_request_destroy(req);
+  rs_request_destroy (req);
 }
 
 static void
@@ -30,8 +31,8 @@ send_more_than_one_msg_in_one_packet (struct rs_connection *conn)
 {
   struct rs_packet *msg0, *msg1;
 
-  assert_true (rs_packet_create_auth_request (conn, &msg0, NULL, NULL) == 0);
-  assert_true (rs_packet_create_auth_request (conn, &msg1, NULL, NULL) == 0);
+  assert_true (rs_packet_create_authn_request (conn, &msg0, NULL, NULL) == 0);
+  assert_true (rs_packet_create_authn_request (conn, &msg1, NULL, NULL) == 0);
   assert_true (rs_packet_send (msg0, NULL) == 0);
   assert_true (rs_packet_send (msg1, NULL) == 0);
 }