Update CDR Unit tests to reflect container changes in r398579
[asterisk/asterisk.git] / tests / test_cdr.c
index a60f78e..4fd1bdb 100644 (file)
@@ -42,10 +42,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/utils.h"
 #include "asterisk/causes.h"
 #include "asterisk/time.h"
-#include "asterisk/bridging.h"
-#include "asterisk/bridging_basic.h"
+#include "asterisk/bridge.h"
+#include "asterisk/bridge_basic.h"
 #include "asterisk/stasis_channels.h"
-#include "asterisk/stasis_bridging.h"
+#include "asterisk/stasis_bridges.h"
 
 #define EPSILON 0.001
 
@@ -278,11 +278,12 @@ static void clear_mock_cdr_backend(void)
        } while (0)
 
 /*! \brief Hang up a test channel safely */
-#define HANGUP_CHANNEL(channel, cause) do { \
-       ast_channel_hangupcause_set((channel), (cause)); \
-       if (!ast_hangup((channel))) { \
+#define HANGUP_CHANNEL(channel, cause) \
+       do { \
+               ast_channel_hangupcause_set((channel), (cause)); \
+               ast_hangup(channel); \
                channel = NULL; \
-       } } while (0)
+       } while (0)
 
 static enum ast_test_result_state verify_mock_cdr_record(struct ast_test *test, struct ast_cdr *expected, int record)
 {
@@ -1807,14 +1808,14 @@ AST_TEST_DEFINE(test_cdr_dial_answer_multiparty)
                .dst = "100",
                .dcontext = "default",
                .channel = CHANNEL_TECH_NAME "/Alice",
-               .dstchannel = CHANNEL_TECH_NAME "/David",
+               .dstchannel = CHANNEL_TECH_NAME "/Charlie",
                .lastapp = "Dial",
                .lastdata = CHANNEL_TECH_NAME "/Bob",
                .amaflags = AST_AMA_DOCUMENTATION,
                .billsec = 1,
                .disposition = AST_CDR_ANSWERED,
                .accountcode = "100",
-               .peeraccount = "400",
+               .peeraccount = "300",
                .next = &charlie_expected_one,
        };
        struct ast_cdr alice_expected_two = {
@@ -1823,14 +1824,14 @@ AST_TEST_DEFINE(test_cdr_dial_answer_multiparty)
                .dst = "100",
                .dcontext = "default",
                .channel = CHANNEL_TECH_NAME "/Alice",
-               .dstchannel = CHANNEL_TECH_NAME "/Charlie",
+               .dstchannel = CHANNEL_TECH_NAME "/David",
                .lastapp = "Dial",
                .lastdata = CHANNEL_TECH_NAME "/Bob",
                .amaflags = AST_AMA_DOCUMENTATION,
                .billsec = 1,
                .disposition = AST_CDR_ANSWERED,
                .accountcode = "100",
-               .peeraccount = "300",
+               .peeraccount = "400",
                .next = &alice_expected_three,
        };
        struct ast_cdr alice_expected_one = {
@@ -2201,9 +2202,8 @@ AST_TEST_DEFINE(test_cdr_fields)
 
        /* Hang up and verify */
        ast_channel_hangupcause_set(chan, AST_CAUSE_NORMAL);
-       if (!ast_hangup(chan)) {
-               chan = NULL;
-       }
+       ast_hangup(chan);
+       chan = NULL;
        result = verify_mock_cdr_record(test, expected, 3);
 
        return result;
@@ -2272,9 +2272,8 @@ AST_TEST_DEFINE(test_cdr_no_reset_cdr)
        ast_test_validate(test, ast_cdr_fork(ast_channel_name(chan), &fork_options) == 0);
 
        ast_channel_hangupcause_set(chan, AST_CAUSE_NORMAL);
-       if (!ast_hangup(chan)) {
-               chan = NULL;
-       }
+       ast_hangup(chan);
+       chan = NULL;
        result = verify_mock_cdr_record(test, &expected, 1);
 
        return result;
@@ -2395,16 +2394,16 @@ AST_TEST_DEFINE(test_cdr_fork_cdr)
        ast_test_validate(test, strcmp(fork_answer_time, answer_time) != 0);
 
        ast_channel_hangupcause_set(chan, AST_CAUSE_NORMAL);
-       if (!ast_hangup(chan)) {
-               chan = NULL;
-       }
+       ast_hangup(chan);
+       chan = NULL;
        result = verify_mock_cdr_record(test, expected, 3);
 
        return result;
 }
 
 /*!
- * \internal \brief Callback function called before each test executes
+ * \internal
+ * \brief Callback function called before each test executes
  */
 static int test_cdr_init_cb(struct ast_test_info *info, struct ast_test *test)
 {
@@ -2415,7 +2414,8 @@ static int test_cdr_init_cb(struct ast_test_info *info, struct ast_test *test)
 }
 
 /*!
- * \internal \brief Callback function called after each test executes
+ * \internal
+ * \brief Callback function called after each test executes
  */
 static int test_cdr_cleanup_cb(struct ast_test_info *info, struct ast_test *test)
 {